Skip to content

Commit 2737b06

Browse files
Merge pull request #483 from Codeinwp/feat/black-friday
feat: add Black Friday integration
2 parents 0421045 + 3e631f3 commit 2737b06

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

includes/classes/wp-maintenance-mode-admin.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ private function __construct() {
7676

7777
// Display custom page state
7878
add_filter( 'display_post_states', array( $this, 'add_display_post_states' ), 10, 2 );
79+
80+
add_filter( 'themeisle_sdk_blackfriday_data', array( $this, 'add_black_friday_data' ) );
7981
}
8082

8183
/**
@@ -235,6 +237,8 @@ public function enqueue_admin_scripts() {
235237

236238
wp_add_inline_script( 'code-editor', sprintf( 'jQuery(function ($) { var custom_css_editor = wp.codeEditor.initialize("other_custom_css", %s); $("body").on("show_design_tab_content", function () { custom_css_editor.codemirror.refresh(); }); });', wp_json_encode( $settings ) ) );
237239
}
240+
241+
do_action( 'themeisle_internal_page', WPMM_PRODUCT_SLUG, 'dashboard' );
238242
}
239243

240244
// For global actions like dismiss notices
@@ -1292,5 +1296,31 @@ public function add_inline_global_style() {
12921296
</style>
12931297
<?php
12941298
}
1299+
1300+
/**
1301+
* Add Black Friday data.
1302+
*
1303+
* @param array $configs The configuration array for the loaded products.
1304+
*
1305+
* @return array
1306+
*/
1307+
public function add_black_friday_data( $configs ) {
1308+
$config = $configs['default'];
1309+
1310+
// translators: %1$s - plugin namce, %2$s - HTML tag, %3$s - discount, %4$s - HTML tag, %5$s - company name.
1311+
$message_template = __( 'Brought to you by the team behind %1$s— our biggest sale of the year is here: %2$sup to %3$s OFF%4$s on premium products from %5$s! Limited-time only.', 'wp-maintenance-mode' );
1312+
1313+
$config['message'] = sprintf( $message_template, 'WP Maintenance Mode', '<strong>', '70%', '</strong>', '<strong>Themeisle</strong>' );
1314+
$config['sale_url'] = add_query_arg(
1315+
array(
1316+
'utm_term' => 'free',
1317+
),
1318+
tsdk_translate_link( tsdk_utmify( 'https://themeisle.link/all-bf', 'bfcm', 'wp-maintenance-mode' ) )
1319+
);
1320+
1321+
$configs[ WPMM_PRODUCT_SLUG ] = $config;
1322+
1323+
return $configs;
1324+
}
12951325
}
12961326
}

wp-maintenance-mode.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
define( 'WPMM_VIEWS_PATH', WPMM_PATH . 'views/' );
3131
define( 'WPMM_CSS_PATH', WPMM_PATH . 'assets/css/' );
3232
define( 'WPMM_TEMPLATES_PATH', WPMM_PATH . 'assets/templates/' );
33+
define( 'WPMM_PRODUCT_SLUG', basename( dirname( __FILE__ ) ) );
3334

3435
/**
3536
* DEFINE URLS

0 commit comments

Comments
 (0)