File tree Expand file tree Collapse file tree 6 files changed +88
-0
lines changed Expand file tree Collapse file tree 6 files changed +88
-0
lines changed Original file line number Diff line number Diff line change
1
+ a [href *= "wp2static-try-1-click-publish" ], .try-1-click-publish-menu-item {
2
+ color : white;
3
+ background-color : # FB4247 ;
4
+ font-weight : bold;
5
+ }
6
+
Original file line number Diff line number Diff line change
1
+ document . addEventListener ( "DOMContentLoaded" , function ( event ) {
2
+
3
+ // locate the submenu item by partial match of its href value
4
+ const try1ClickPublish = document . querySelector ( 'a[href*="wp2static-try-1-click-publish"]' ) ;
5
+
6
+ // add a class, for easier style application
7
+ try1ClickPublish . classList . add ( 'try-1-click-publish-menu-item' ) ;
8
+
9
+ // set to open the link in new window
10
+ try1ClickPublish . target = "_blank" ;
11
+
12
+ // set a custom external href for the submenu item
13
+ try1ClickPublish . href = 'https://www.strattic.com/pricing/?utm_campaign=start-trial&utm_source=wp2static&utm_medium=wp-dash&utm_content=sidebar' ;
14
+
15
+ } ) ;
Original file line number Diff line number Diff line change @@ -209,6 +209,15 @@ public static function registerOptionsPage() : void {
209
209
);
210
210
}
211
211
212
+ add_submenu_page (
213
+ 'wp2static ' ,
214
+ 'WP2Static - Try 1-Click Publish ' ,
215
+ 'Try 1-Click Publish ' ,
216
+ 'manage_options ' ,
217
+ 'wp2static-try-1-click-publish ' ,
218
+ [ ViewRenderer::class, 'renderTry1ClickPublish ' ]
219
+ );
220
+
212
221
add_submenu_page (
213
222
'' ,
214
223
'WP2Static Crawl Queue ' ,
Original file line number Diff line number Diff line change @@ -58,6 +58,15 @@ public static function renderAddonsPage() : void {
58
58
require_once WP2STATIC_PATH . 'views/addons-page.php ' ;
59
59
}
60
60
61
+ public static function renderTry1ClickPublish () : void {
62
+ if ( ! is_admin () ) {
63
+ http_response_code ( 403 );
64
+ die ( 'Forbidden ' );
65
+ }
66
+
67
+ require_once WP2STATIC_PATH . 'views/try-1-click-publishing.php ' ;
68
+ }
69
+
61
70
public static function renderCrawlQueue () : void {
62
71
if ( ! is_admin () ) {
63
72
http_response_code ( 403 );
Original file line number Diff line number Diff line change @@ -293,6 +293,18 @@ public static function registerHooks( string $bootstrap_file ) : void {
293
293
0
294
294
);
295
295
296
+ add_action (
297
+ 'admin_enqueue_scripts ' ,
298
+ [ self ::class, 'wp2staticAdminStyles ' ],
299
+ 0
300
+ );
301
+
302
+ add_action (
303
+ 'admin_enqueue_scripts ' ,
304
+ [ self ::class, 'wp2staticAdminScripts ' ],
305
+ 0
306
+ );
307
+
296
308
/*
297
309
* Register actions for when we should invalidate cache for
298
310
* a URL(s) or whole site
@@ -355,5 +367,26 @@ public static function adminPostProcessQueue() : void {
355
367
356
368
Controller::wp2staticProcessQueue ();
357
369
}
370
+
371
+ public function wp2staticAdminStyles () : void {
372
+ wp_register_style (
373
+ 'wp2static_admin_styles ' ,
374
+ plugins_url ( '../css/admin/style.css ' , __FILE__ ),
375
+ [],
376
+ WP2STATIC_VERSION
377
+ );
378
+ wp_enqueue_style ( 'wp2static_admin_styles ' );
379
+ }
380
+
381
+ public function wp2staticAdminScripts () : void {
382
+ wp_register_script (
383
+ 'wp2static_admin_scripts ' ,
384
+ plugins_url ( '../js/admin/override-menu-style.js ' , __FILE__ ),
385
+ [],
386
+ WP2STATIC_VERSION ,
387
+ false
388
+ );
389
+ wp_enqueue_script ( 'wp2static_admin_scripts ' );
390
+ }
358
391
}
359
392
Original file line number Diff line number Diff line change
1
+ <?php
2
+ // phpcs:disable Generic.Files.LineLength.MaxExceeded
3
+ // phpcs:disable Generic.Files.LineLength.TooLong
4
+
5
+ // Fallback template, in case JS fails to override the WP2Static submenu item
6
+
7
+ ?>
8
+
9
+ <div class="wrap">
10
+ <h1>Try 1-Click static site publishing!</h1>
11
+
12
+ <p>Loving WP2Static but want to try 1-Click Publish on Strattic?</p>
13
+
14
+ <p><a href="https://www.strattic.com/pricing/?utm_campaign=start-trial&utm_source=wp2static&utm_medium=wp-dash&utm_content=sidebar">Click here</a> to try Strattic for free today!</p>
15
+
16
+ </div>
You can’t perform that action at this time.
0 commit comments