myStickymenu - Version 1.8.9

Version Description

  • Added: New option - Disable at certain posts and pages.
Download this release

Release Info

Developer damiroquai
Plugin Icon 128x128 myStickymenu
Version 1.8.9
Comparing to
See all releases

Code changes from version 1.8.8 to 1.8.9

Files changed (2) hide show
  1. mystickymenu.php +325 -10
  2. readme.txt +7 -1
mystickymenu.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: myStickymenu
4
Plugin URI: http://wordpress.transformnews.com/plugins/mystickymenu-simple-sticky-fixed-on-top-menu-implementation-for-twentythirteen-menu-269
5
Description: Simple sticky (fixed on top) menu implementation for default Twentythirteen navigation menu. For other themes, after install go to Settings / myStickymenu and change Sticky Class to .your_navbar_class or #your_navbar_id.
6
- Version: 1.8.8
7
Author: m.r.d.a
8
Author URI: http://wordpress.transformnews.com/
9
Text Domain: mystickymenu
@@ -157,6 +157,68 @@ class MyStickyMenuBackend
157
'my-stickymenu-settings',
158
'setting_section_id'
159
);
160
}
161
/**
162
* Sanitize each setting field as needed
@@ -198,6 +260,39 @@ class MyStickyMenuBackend
198
199
if( isset( $input['disable_css'] ) )
200
$new_input['disable_css'] = sanitize_text_field( $input['disable_css'] );
201
202
return $new_input;
203
}
@@ -365,6 +460,107 @@ class MyStickyMenuBackend
365
echo '</p>';
366
}
367
368
}
369
370
@@ -374,25 +570,38 @@ class MyStickyMenuFrontend
374
375
public function __construct()
376
{
377
add_action( 'wp_head', array( $this, 'mysticky_build_stylesheet_content' ) );
378
- add_action( 'wp_enqueue_scripts', array( $this, 'mystickymenu_script' ) );
379
380
}
381
382
public function mysticky_build_stylesheet_content()
383
{
384
-
385
$mysticky_options = get_option( 'mysticky_option_name' );
386
387
- if (isset($mysticky_options['disable_css']))
388
- {
389
- //do nothing
390
- } else {
391
- $mysticky_options['disable_css'] = false;
392
- };
393
394
if ($mysticky_options ['disable_css'] == false )
395
{
396
397
echo
398
'<style type="text/css">';
@@ -474,6 +683,111 @@ class MyStickyMenuFrontend
474
}
475
476
//add_action( 'wp_enqueue_scripts', 'mystickymenu_script' );
477
}
478
479
if( is_admin() ) {
@@ -481,7 +795,8 @@ if( is_admin() ) {
481
new MyStickyMenuBackend();
482
483
} else {
484
-
485
new MyStickyMenuFrontend();
486
}
487
?>
3
Plugin Name: myStickymenu
4
Plugin URI: http://wordpress.transformnews.com/plugins/mystickymenu-simple-sticky-fixed-on-top-menu-implementation-for-twentythirteen-menu-269
5
Description: Simple sticky (fixed on top) menu implementation for default Twentythirteen navigation menu. For other themes, after install go to Settings / myStickymenu and change Sticky Class to .your_navbar_class or #your_navbar_id.
6
+ Version: 1.8.9
7
Author: m.r.d.a
8
Author URI: http://wordpress.transformnews.com/
9
Text Domain: mystickymenu
157
'my-stickymenu-settings',
158
'setting_section_id'
159
);
160
+
161
+
162
+
163
+ add_settings_field(
164
+ 'mysticky_disable_at_front_home',
165
+ __("Disable at", 'mystickysidebar'),
166
+ array( $this, 'mysticky_enable_callback' ),
167
+ 'my-stickymenu-settings',
168
+ 'setting_section_id'
169
+ );
170
+ add_settings_field(
171
+ 'mysticky_disable_at_blog',
172
+ __("Disable at", 'mystickysidebar'),
173
+ 'my-stickymenu-settings',
174
+ 'setting_section_id'
175
+ );
176
+ add_settings_field(
177
+ 'mysticky_disable_at_page',
178
+ __("Disable at", 'mystickysidebar'),
179
+ 'my-stickymenu-settings',
180
+ 'setting_section_id'
181
+ );
182
+ add_settings_field(
183
+ 'mysticky_disable_at_tag',
184
+ __("Disable at", 'mystickysidebar'),
185
+ 'my-stickymenu-settings',
186
+ 'setting_section_id'
187
+ );
188
+ add_settings_field(
189
+ 'mysticky_disable_at_category',
190
+ __("Disable at", 'mystickysidebar'),
191
+ 'my-stickymenu-settings',
192
+ 'setting_section_id'
193
+ );
194
+ add_settings_field(
195
+ 'mysticky_disable_at_single',
196
+ __("Disable at", 'mystickysidebar'),
197
+ 'my-stickymenu-settings',
198
+ 'setting_section_id'
199
+ );
200
+ add_settings_field(
201
+ 'mysticky_disable_at_archive',
202
+ __("Disable at", 'mystickysidebar'),
203
+ 'my-stickymenu-settings',
204
+ 'setting_section_id'
205
+ );
206
+ add_settings_field(
207
+ 'mysticky_enable_at_pages',
208
+ __("", 'mystickysidebar'),
209
+ 'my-stickymenu-settings',
210
+ 'setting_section_id'
211
+ );
212
+ add_settings_field(
213
+ 'mysticky_enable_at_posts',
214
+ __("", 'mystickysidebar'),
215
+ 'my-stickymenu-settings',
216
+ 'setting_section_id'
217
+ );
218
+
219
+
220
+
221
+
222
}
223
/**
224
* Sanitize each setting field as needed
260
261
if( isset( $input['disable_css'] ) )
262
$new_input['disable_css'] = sanitize_text_field( $input['disable_css'] );
263
+
264
+
265
+
266
+ if( isset( $input['mysticky_disable_at_front_home'] ) )
267
+ $new_input['mysticky_disable_at_front_home'] = sanitize_text_field( $input['mysticky_disable_at_front_home'] );
268
+
269
+ if( isset( $input['mysticky_disable_at_blog'] ) )
270
+ $new_input['mysticky_disable_at_blog'] = sanitize_text_field( $input['mysticky_disable_at_blog'] );
271
+
272
+ if( isset( $input['mysticky_disable_at_page'] ) )
273
+ $new_input['mysticky_disable_at_page'] = sanitize_text_field( $input['mysticky_disable_at_page'] );
274
+
275
+ if( isset( $input['mysticky_disable_at_tag'] ) )
276
+ $new_input['mysticky_disable_at_tag'] = sanitize_text_field( $input['mysticky_disable_at_tag'] );
277
+
278
+ if( isset( $input['mysticky_disable_at_category'] ) )
279
+ $new_input['mysticky_disable_at_category'] = sanitize_text_field( $input['mysticky_disable_at_category'] );
280
+
281
+ if( isset( $input['mysticky_disable_at_single'] ) )
282
+ $new_input['mysticky_disable_at_single'] = sanitize_text_field( $input['mysticky_disable_at_single'] );
283
+
284
+ if( isset( $input['mysticky_disable_at_archive'] ) )
285
+ $new_input['mysticky_disable_at_archive'] = sanitize_text_field( $input['mysticky_disable_at_archive'] );
286
+
287
+ if( isset( $input['mysticky_enable_at_pages'] ) )
288
+ $new_input['mysticky_enable_at_pages'] = sanitize_text_field( $input['mysticky_enable_at_pages'] );
289
+
290
+ if( isset( $input['mysticky_enable_at_posts'] ) )
291
+ $new_input['mysticky_enable_at_posts'] = sanitize_text_field( $input['mysticky_enable_at_posts'] );
292
+
293
+
294
+
295
+
296
297
return $new_input;
298
}
460
echo '</p>';
461
}
462
463
+
464
+
465
+
466
+
467
+
468
+
469
+
470
+
471
+
472
+
473
+
474
+
475
+ public function mysticky_enable_callback()
476
+ {
477
+
478
+ _e('<span>front page </span>', 'mystickymenu');
479
+ printf(
480
+ '<input id="%1$s" name="mysticky_option_name[mysticky_disable_at_front_home]" type="checkbox" %2$s /> ',
481
+ 'mysticky_disable_at_front_home',
482
+ checked( isset( $this->options['mysticky_disable_at_front_home'] ), true, false )
483
+ ) ;
484
+ _e('<span>blog page </span>', 'mystickymenu');
485
+ printf(
486
+ '<input id="%1$s" name="mysticky_option_name[mysticky_disable_at_blog]" type="checkbox" %2$s /> ',
487
+ 'mysticky_disable_at_blog',
488
+ checked( isset( $this->options['mysticky_disable_at_blog'] ), true, false )
489
+ );
490
+ _e('<span>pages </span>', 'mystickymenu');
491
+ printf(
492
+ '<input id="%1$s" name="mysticky_option_name[mysticky_disable_at_page]" type="checkbox" %2$s /> ',
493
+ 'mysticky_disable_at_page',
494
+ checked( isset( $this->options['mysticky_disable_at_page'] ), true, false )
495
+ );
496
+ _e('<span>tags </span>', 'mystickymenu');
497
+ printf(
498
+ '<input id="%1$s" name="mysticky_option_name[mysticky_disable_at_tag]" type="checkbox" %2$s /> ',
499
+ 'mysticky_disable_at_tag',
500
+ checked( isset( $this->options['mysticky_disable_at_tag'] ), true, false )
501
+ );
502
+ _e('<span>categories </span>', 'mystickymenu');
503
+ printf(
504
+ '<input id="%1$s" name="mysticky_option_name[mysticky_disable_at_category]" type="checkbox" %2$s /> ',
505
+ 'mysticky_disable_at_category',
506
+ checked( isset( $this->options['mysticky_disable_at_category'] ), true, false )
507
+ );
508
+ _e('<span>posts </span>', 'mystickymenu');
509
+ printf(
510
+ '<input id="%1$s" name="mysticky_option_name[mysticky_disable_at_single]" type="checkbox" %2$s /> ',
511
+ 'mysticky_disable_at_single',
512
+ checked( isset( $this->options['mysticky_disable_at_single'] ), true, false )
513
+ );
514
+ _e('<span>archives </span>', 'mystickymenu');
515
+ printf(
516
+ '<input id="%1$s" name="mysticky_option_name[mysticky_disable_at_archive]" type="checkbox" %2$s /> ',
517
+ 'mysticky_disable_at_archive',
518
+ checked( isset( $this->options['mysticky_disable_at_archive'] ), true, false )
519
+ );
520
+
521
+ if (isset ( $this->options['mysticky_disable_at_page'] ) == true ) {
522
+
523
+ echo '<p> </p> <hr />';
524
+ _e('<span class="">Except for this pages: </span>', 'mystickymenu');
525
+
526
+ printf(
527
+ '<input type="text" size="26" id="mysticky_enable_at_pages" name="mysticky_option_name[mysticky_enable_at_pages]" value="%s" /> ',
528
+ isset( $this->options['mysticky_enable_at_pages'] ) ? esc_attr( $this->options['mysticky_enable_at_pages']) : ''
529
+ );
530
+
531
+ _e('<span class="description">Comma separated list of pages to enable. It should be page name, id or slug. Example: about-us, 1134, Contact Us. Leave blank if you realy want to disable sticky sidebar for all pages.</span>', 'mystickymenu');
532
+
533
+ }
534
+
535
+ if (isset ( $this->options['mysticky_disable_at_single'] ) == true ) {
536
+
537
+ echo '<p> </p> <hr />';
538
+ _e('<span class="">Except for this posts: </span>', 'mystickymenu');
539
+
540
+ printf(
541
+ '<input type="text" size="26" id="mysticky_enable_at_posts" name="mysticky_option_name[mysticky_enable_at_posts]" value="%s" /> ',
542
+ isset( $this->options['mysticky_enable_at_posts'] ) ? esc_attr( $this->options['mysticky_enable_at_posts']) : ''
543
+ );
544
+
545
+ _e('<span class="description">Comma separated list of posts to enable. It should be post name, id or slug. Example: about-us, 1134, Contact Us. Leave blank if you realy want to disable sticky sidebar for all posts.</span>', 'mystickymenu');
546
+
547
+ }
548
+
549
+ }
550
+
551
+
552
+
553
+
554
+
555
+
556
+
557
+
558
+
559
+
560
+
561
+
562
+
563
+
564
}
565
566
570
571
public function __construct()
572
{
573
+
574
add_action( 'wp_head', array( $this, 'mysticky_build_stylesheet_content' ) );
575
+ add_action( 'wp_enqueue_scripts', array( $this, 'mysticky_disable_at' ) );
576
577
}
578
579
public function mysticky_build_stylesheet_content()
580
+
581
{
582
+
583
$mysticky_options = get_option( 'mysticky_option_name' );
584
585
+ if (isset($mysticky_options['disable_css']))
586
+
587
+ {
588
+
589
+ //do nothing
590
+
591
+ } else {
592
+
593
+ $mysticky_options['disable_css'] = false;
594
+
595
+ };
596
597
if ($mysticky_options ['disable_css'] == false )
598
+
599
{
600
+
601
+
602
+
603
+
604
+
605
606
echo
607
'<style type="text/css">';
683
}
684
685
//add_action( 'wp_enqueue_scripts', 'mystickymenu_script' );
686
+
687
+
688
+ public function mysticky_disable_at() {
689
+
690
+
691
+ $mysticky_options = get_option( 'mysticky_option_name' );
692
+
693
+ $mysticky_disable_at_front_home = isset($mysticky_options['mysticky_disable_at_front_home']);
694
+ $mysticky_disable_at_blog = isset($mysticky_options['mysticky_disable_at_blog']);
695
+ $mysticky_disable_at_page = isset($mysticky_options['mysticky_disable_at_page']);
696
+ $mysticky_disable_at_tag = isset($mysticky_options['mysticky_disable_at_tag']);
697
+ $mysticky_disable_at_category = isset($mysticky_options['mysticky_disable_at_category']);
698
+ $mysticky_disable_at_single = isset($mysticky_options['mysticky_disable_at_single']);
699
+ $mysticky_disable_at_archive = isset($mysticky_options['mysticky_disable_at_archive']);
700
+
701
+ $mysticky_enable_at_pages = isset($mysticky_options['mysticky_enable_at_pages']) ? $mysticky_options['mysticky_enable_at_pages'] : '';
702
+ $mysticky_enable_at_posts = isset($mysticky_options['mysticky_enable_at_posts']) ? $mysticky_options['mysticky_enable_at_posts'] : '';
703
+ //$mystickymenu_enable_at_pages_exp = explode( ',', $mystickymenu_enable_at_pages );
704
+ // Trim input to ignore empty spaces
705
+ $mysticky_enable_at_pages_exp = array_map('trim', explode(',', $mysticky_enable_at_pages));
706
+ $mysticky_enable_at_posts_exp = array_map('trim', explode(',', $mysticky_enable_at_posts));
707
+
708
+
709
+
710
+
711
+ if ( is_front_page() && is_home() ) {
712
+ // Default homepage
713
+ if ( $mysticky_disable_at_front_home == false ) {
714
+ $this->mystickymenu_script();
715
+
716
+ };
717
+
718
+
719
+ } elseif ( is_front_page()){
720
+ //Static homepage
721
+ if ( $mysticky_disable_at_front_home == false ) {
722
+ $this->mystickymenu_script();
723
+ };
724
+
725
+
726
+ } elseif ( is_home()){
727
+
728
+ //Blog page
729
+ if ( $mysticky_disable_at_blog == false ) {
730
+ $this->mystickymenu_script();
731
+ };
732
+
733
+
734
+ } elseif ( is_page() ){
735
+
736
+ //Single page
737
+ if ( $mysticky_disable_at_page == false ) {
738
+ $this->mystickymenu_script();
739
+ };
740
+
741
+ if ( is_page( $mysticky_enable_at_pages_exp ) ){
742
+ $this->mystickymenu_script();
743
+ }
744
+
745
+
746
+ } elseif ( is_tag()){
747
+
748
+ //Tag page
749
+ if ( $mysticky_disable_at_tag == false ) {
750
+ $this->mystickymenu_script();
751
+ };
752
+
753
+ } elseif ( is_category()){
754
+
755
+ //Category page
756
+ if ( $mysticky_disable_at_category == false ) {
757
+ $this->mystickymenu_script();
758
+ };
759
+
760
+
761
+ } elseif ( is_single()){
762
+
763
+ //Single post
764
+ if ( $mysticky_disable_at_single == false ) {
765
+ $this->mystickymenu_script();
766
+ };
767
+
768
+ if ( is_single( $mysticky_enable_at_posts_exp ) ){
769
+ $this->mystickymenu_script();
770
+ }
771
+
772
+ } elseif ( is_archive()){
773
+
774
+ //Archive
775
+ if ( $mysticky_disable_at_archive == false ) {
776
+ $this->mystickymenu_script();
777
+ };
778
+
779
+ }
780
+
781
+ }
782
+
783
+
784
+
785
+
786
+
787
+
788
+
789
+
790
+
791
}
792
793
if( is_admin() ) {
795
new MyStickyMenuBackend();
796
797
} else {
798
+
799
new MyStickyMenuFrontend();
800
+
801
}
802
?>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wordpress.transformnews.com/contact
4
Tags: sticky, menu, header, sticky menu, sticky header, floating, floating menu
5
Requires at least: 3.5.1
6
Tested up to: 4.8
7
- Stable tag: 1.8.8
8
License: GPLv2 or later
9
10
This lightweight plugin will made your menu or header sticky on top of page, after desired number of pixels when scrolled.
@@ -56,6 +56,12 @@ In some cases you can use the whole header div and than just style it different
56
57
== Changelog ==
58
59
= 1.8.7 =
60
* Fixed: minor bug when browser resized.
61
4
Tags: sticky, menu, header, sticky menu, sticky header, floating, floating menu
5
Requires at least: 3.5.1
6
Tested up to: 4.8
7
+ Stable tag: 1.8.9
8
License: GPLv2 or later
9
10
This lightweight plugin will made your menu or header sticky on top of page, after desired number of pixels when scrolled.
56
57
== Changelog ==
58
59
+ = 1.8.9 =
60
+ * Added: New option - Disable at certain posts and pages.
61
+
62
+ = 1.8.8 =
63
+ * Fixed: removed esc_attr for echo css, since input is already sanitized.
64
+
65
= 1.8.7 =
66
* Fixed: minor bug when browser resized.
67