-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathslicknav-mobile-menu.php
1138 lines (981 loc) · 39 KB
/
slicknav-mobile-menu.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php namespace ng_slicknav;
/*
Plugin Name: SlickNav Mobile Menu
Plugin URI: http://wpbeaches.com/using-slick-responsive-menus-genesis-child-theme/
Description: Using SlickNav Responsive Mobile Menus in WordPress
Author: Neil Gee
Version: 1.9.1
Author URI: http://wpbeaches.com
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Text Domain: slicknav-mobile-menu
Domain Path: /languages/
*/
// If called direct, refuse
if ( ! defined( 'ABSPATH' ) ) {
die;
}
/**
* Register our text domain.
*/
function load_textdomain() {
load_plugin_textdomain( 'slicknav-mobile-menu', false, basename( dirname( __FILE__ ) ) . '/languages' );
}
add_action( 'plugins_loaded', __NAMESPACE__ . '\\load_textdomain' );
/*
* Script-tac-ulous -> All the Scripts and Styles for SlickNav Registered and Enqueued
*/
function scripts_styles() {
$options = get_option( 'ng_slicknavmenu' );
if ( $options !== false ) {
wp_register_script( 'slicknavjs' , plugins_url( '/js/jquery.slicknav.min.js', __FILE__ ), array( 'jquery' ), '1.0.11', false );
// wp_register_script( 'slicknavjs' , plugins_url( '/js/jquery.slicknav-ng.js', __FILE__ ), array( 'jquery' ), '1.0.11', false );
wp_register_script( 'velocityjs' , plugins_url( '/js/velocity.min.js', __FILE__ ), array( 'jquery' ), '1.0.11', false );
// wp_register_style( 'slicknavcss' , plugins_url( '/css/slicknav.css', __FILE__ ), '' , '1.0.10', 'all' );
wp_register_style( 'slicknavcss' , plugins_url( '/css/slicknav.min.css', __FILE__ ), '' , '1.0.11', 'all' );
wp_register_script( 'slicknav-init' , plugins_url( '/js/slick-init.js', __FILE__ ), array( 'slicknavjs' ), '1.9.1', false );
wp_enqueue_script( 'slicknavjs' );
wp_enqueue_style( 'slicknavcss' );
// Add new plugin options defaults here, set them to blank, this will avoid PHP notices of undefined, if new options are introduced to the plugin and are not saved or udated then the setting will be defined.
$options_default = array(
'ng_slicknav_close_click' => '',
'ng_slicknav_search_text' => '',
'ng_slicknav_alt' => '',
'ng_slicknav_brand_text' => '',
'ng_slicknav_search' => '',
'ng_slicknav_closedsymbol' => '',
'ng_slicknav_openedsymbol' => '',
'ng_slicknav_fixhead' => '',
'ng_slicknav_child_links' => '',
'ng_slicknav_parent_links' => '',
'ng_slicknav_accordion' => '',
'ng_slicknav_animation_library' => '',
'ng_slicknav_hidedesktop' => '',
);
$options = wp_parse_args( $options, $options_default );
// Enqueue Dashicons only if Search option is ticked
if( (bool) $options['ng_slicknav_search'] == true ) {
wp_enqueue_style( 'dashicons' );
}
// Enqueue Velocity library only if selected
if( esc_html( $options['ng_slicknav_animation_library'] == 'velocity' )) {
wp_enqueue_script( 'velocityjs' );
}
$data = array (
'ng_slicknav' => array(
'ng_slicknav_menu' => esc_html( $options['ng_slicknav_menu'] ),
'ng_slicknav_position' => esc_html( $options['ng_slicknav_position'] ),
'ng_slicknav_parent_links' => (bool)$options['ng_slicknav_parent_links'],
'ng_slicknav_close_click' => (bool)$options['ng_slicknav_close_click'],
'ng_slicknav_child_links' => (bool) $options['ng_slicknav_child_links'],
'ng_slicknav_speed' => (int)$options['ng_slicknav_speed'],
'ng_slicknav_label' => esc_html( $options['ng_slicknav_label'] ),
'ng_slicknav_fixhead' => (bool) $options['ng_slicknav_fixhead'],
'ng_slicknav_hidedesktop' => esc_html( $options['ng_slicknav_hidedesktop']),
'ng_slicknav_brand' => esc_html( $options['ng_slicknav_brand'] ),
'ng_slicknav_brand_text' => $options['ng_slicknav_brand_text'],
'ng_slicknav_search' => (bool) $options['ng_slicknav_search'],
'ng_slicknav_search_text' => esc_html( $options['ng_slicknav_search_text'] ),
'ng_slicksearch' => home_url( '/' ),
'ng_slicknav_closedsymbol' => esc_html( $options['ng_slicknav_closedsymbol'] ),
'ng_slicknav_openedsymbol' => esc_html( $options['ng_slicknav_openedsymbol'] ),
'ng_slicknav_alt' => esc_html( $options['ng_slicknav_alt'] ),
'ng_slicknav_accordion' => (bool)$options['ng_slicknav_accordion'],
'ng_slicknav_animation_library' => esc_html( $options['ng_slicknav_animation_library'] ),
),
);
//add filter
$data = apply_filters( 'ng_slicknav_slickNavVars', $data );
// Pass PHP variables to jQuery script
wp_localize_script( 'slicknav-init', 'slickNavVars', $data );
wp_enqueue_script( 'slicknav-init' );
}
}
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\\scripts_styles' );
// Get the inline CSS
require_once plugin_dir_path( __FILE__ ) . 'inc/inlinecss.php';
/*
* Use the add options_page function
* add_options_page( $page_title, $menu_title, $capability, $menu-slug, $function )
*/
function slicknav_menu() {
add_options_page(
__( 'SlickNav Options Plugin','slicknav-mobile-menu' ), //$page_title
__( 'SlickNav Menu', 'slicknav-mobile-menu' ), //$menu_title
'manage_options', //$capability
'wpslicknav-menu', //$menu-slug
__NAMESPACE__ . '\\menu_options_page' //$function
);
}
add_action( 'admin_menu', __NAMESPACE__ . '\\slicknav_menu' );
/*
* Add menu options pages
*
*/
function menu_options_page() {
if( !current_user_can( 'manage_options' ) ) {
wp_die( "Hall and Oates 'Say No Go'" );
}
require( 'inc/options-page-wrapper.php' );
}
/**
* Register our option fields
*
* @since 1.0.0
*/
function plugin_settings() {
register_setting(
'ng_settings_groups_zz', //option name
'ng_slicknavmenu',// option group setting name and option name
__NAMESPACE__ . '\\slicknav_validate_input' //sanitize the inputs
);
add_settings_section(
'ng_slicknav_section', //declare the section id
'', //page title
__NAMESPACE__ . '\\ng_slicknav_section_callback', //callback function below
'wpslicknav-menu' //page that it appears on
);
add_settings_field(
'ng_slicknav_menu', //unique id of field
'Add Menu to Replace', //title
__NAMESPACE__ . '\\ng_slicknav_menu_callback', //callback function below
'wpslicknav-menu', //page that it appears on
'ng_slicknav_section' //settings section declared in add_settings_section
);
add_settings_field(
'ng_slicknav_width', //unique id of field
'Pixel Width to Switch to SlickNav', //title
__NAMESPACE__ . '\\ng_slicknav_width_callback', //callback function below
'wpslicknav-menu', //page that it appears on
'ng_slicknav_section' //settings section declared in add_settings_section
);
add_settings_field(
'ng_slicknav_hidedesktop',
'Display Desktop Menu, leave at block, unless you are displaying it differently',
__NAMESPACE__ . '\\ng_slicknav_hidedesktop_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_fixhead',
'Fix Menu to Head',
__NAMESPACE__ . '\\ng_slicknav_fixhead_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_header',
'Hide Main Header ',
__NAMESPACE__ . '\\ng_slicknav_header_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_brand',
'Image Logo - Enter a URL or upload an image for a logo, smaller is better here, like 45px in depth and up to 200px in width, default position is left, to swap to right change Menu Button Position (above) to left ',
__NAMESPACE__ . '\\ng_slicknav_brand_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_alt',
'Logo Alt Text ',
__NAMESPACE__ . '\\ng_slicknav_alt_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_brand_text',
'Text Logo - Enter text for Logo',
__NAMESPACE__ . '\\ng_slicknav_brand_text_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_brand_text_color',
'Text Logo Color',
__NAMESPACE__ . '\\ng_slicknav_brand_text_color_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_button_position',
'Menu Button Position',
__NAMESPACE__ . '\\ng_slicknav_button_position_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_submenu_position',
'SubMenu Indicator Position',
__NAMESPACE__ . '\\ng_slicknav_submenu_position_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_background', //unique id of field
'Menu Background Color', //title
__NAMESPACE__ . '\\ng_slicknav_background_callback', //callback function below
'wpslicknav-menu', //page that it appears on
'ng_slicknav_section' //settings section declared in add_settings_section
);
add_settings_field(
'ng_slicknav_button', //unique id of field
'Menu Button Color', //title
__NAMESPACE__ . '\\ng_slicknav_button_callback', //callback function below
'wpslicknav-menu', //page that it appears on
'ng_slicknav_section' //settings section declared in add_settings_section
);
add_settings_field(
'ng_slicknav_button_expand', //unique id of field
'Menu Button Color when Menu expanded', //title
__NAMESPACE__ . '\\ng_slicknav_button_expand_callback', //callback function below
'wpslicknav-menu', //page that it appears on
'ng_slicknav_section' //settings section declared in add_settings_section
);
add_settings_field(
'ng_slicknav_label_color',
'Label Color',
__NAMESPACE__ . '\\ng_slicknav_label_color_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_icon_color',
'Hamburger Icon Color',
__NAMESPACE__ . '\\ng_slicknav_icon_color_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_label_shadow',
'Label Shadow',
__NAMESPACE__ . '\\ng_slicknav_label_shadow_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_icon_shadow',
'Icon Shadow',
__NAMESPACE__ . '\\ng_slicknav_icon_shadow_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_link_color',
'Link Color',
__NAMESPACE__ . '\\ng_slicknav_link_color_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_link_hover_color',
'Link Hover Color',
__NAMESPACE__ . '\\ng_slicknav_link_hover_color_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_link_hover_background_color',
'Link Hover Background Color',
__NAMESPACE__ . '\\ng_slicknav_link_hover_background_color_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_search',
'Show search field at bottom of Menu',
__NAMESPACE__ . '\\ng_slicknav_search_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_search_text',
'Search Label Name',
__NAMESPACE__ . '\\ng_slicknav_search_text_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_search_icon_color',
'Search Icon Color',
__NAMESPACE__ . '\\ng_slicknav_search_icon_color_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_search_color',
'Search Icon Background Color',
__NAMESPACE__ . '\\ng_slicknav_search_color_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_font',
'Font Size',
__NAMESPACE__ . '\\ng_slicknav_font_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_label_size',
'Label Font Size',
__NAMESPACE__ . '\\ng_slicknav_label_size_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_label_weight',
'Label Weight',
__NAMESPACE__ . '\\ng_slicknav_label_weight_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_font_case',
'Font Case',
__NAMESPACE__ . '\\ng_slicknav_font_case_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_position',
'Menu Position',
__NAMESPACE__ . '\\ng_slicknav_position_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_label',
'Menu Label Name',
__NAMESPACE__ . '\\ng_slicknav_label_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_close_click',
'Close Menu on Click ',
__NAMESPACE__ . '\\ng_slicknav_close_click_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_parent_links',
'Allow Parent Links',
__NAMESPACE__ . '\\ng_slicknav_parent_links_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_child_links',
'Show Child Links on Open',
__NAMESPACE__ . '\\ng_slicknav_child_links_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_accordion',
'Toggle Submenus',
__NAMESPACE__ . '\\ng_slicknav_accordion_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_speed',
'Speed of Menu open/close (Higher numbers are slower)',
__NAMESPACE__ . '\\ng_slicknav_speed_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_animation_library',
'Animation Library',
__NAMESPACE__ . '\\ng_slicknav_animation_library_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_closedsymbol',
'Closed Symbol, default ►',
__NAMESPACE__ . '\\ng_slicknav_closedsymbol_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
add_settings_field(
'ng_slicknav_openedsymbol',
'Opened Symbol, default ▼',
__NAMESPACE__ . '\\ng_slicknav_openedsymbol_callback',
'wpslicknav-menu',
'ng_slicknav_section'
);
}
add_action('admin_init', __NAMESPACE__ . '\\plugin_settings');
/**
* Sanitize our inputs
*
* @since 1.8.0
*/
function slicknav_validate_input( $input ) {
// Create our array for storing the validated options
$output = array();
// Loop through each of the incoming options
foreach( $input as $key => $value ) {
if( isset( $input['ng_slicknav_brand_text'] ) ) {
// Keep HTML in this field
$output['ng_slicknav_brand_text'] = wp_kses_post($input['ng_slicknav_brand_text']);
//$output['ng_menu_html_carat'] = wp_filter_post_kses( wp_slash( $input['ng_menu_html_carat'] ) ); // wp_filter_post_kses() expects slashed
} // end if
// Check to see if the current option has a value. If so, process it.
if( isset( $input[$key] ) ) {
// Strip all HTML and PHP tags and properly handle quoted strings
$output[$key] = strip_tags( stripslashes( $input[ $key ] ) );
} // end if
} // end foreach
// Return the array processing any additional functions filtered by this action
return apply_filters( 'slicknav_validate_input' , $output, $input );
}
/**
* Register our section call back
* (not much happening here)
* @since 1.0.0
*/
function ng_slicknav_section_callback() {
}
/**
* Main input field for menu selection to SlickNav
*
* @since 1.8.0
*/
function ng_slicknav_menu_callback() {
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_menu'] ) ) $options['ng_slicknav_menu'] = '';
echo '<input type="text" id="ng_slicknav_menu" name="ng_slicknavmenu[ng_slicknav_menu]" value="' . sanitize_text_field($options['ng_slicknav_menu']) . '" placeholder="Add menus here..." class="large-text" />';
echo '<span class="description">' . __( 'Add the Menu CSS Class or ID to be used as SickNav Menu, comma separate multiple menus','slicknav-mobile-menu') . '</span>';
}
/**
* Main input field for width selection change menu to SlickNav
*
* @since 1.8.0
*/
function ng_slicknav_width_callback() {
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_width'] ) ) $options['ng_slicknav_width'] = 600;
echo '<input type="number" class="regular-text" name="ng_slicknavmenu[ng_slicknav_width]" value="' . sanitize_text_field($options['ng_slicknav_width']) . '"/>';
}
/**
* Main font size
*
* @since 1.8.0
*/
function ng_slicknav_font_callback() {
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_font'] ) ) $options['ng_slicknav_font'] = 16;
echo '<input type="number" class="regular-text" name="ng_slicknavmenu[ng_slicknav_font]" value="' . sanitize_text_field($options['ng_slicknav_font']) . '"/>';
}
/**
* Main label font size
*
* @since 1.8.0
*/
function ng_slicknav_label_size_callback() {
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_label_size'] ) ) $options['ng_slicknav_label_size'] = 16;
echo '<input type="number" class="regular-text" name="ng_slicknavmenu[ng_slicknav_label_size]" value="' . sanitize_text_field($options['ng_slicknav_label_size']) . '"/>';
}
/**
* Menu backgroud color
*
* @since 1.8.0
*/
function ng_slicknav_background_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_background'] ) ) $options['ng_slicknav_background'] = '#4c4c4c';
echo '<input type="text" class="color-picker" data-alpha-enabled="true" data-default-color="#4c4c4c" name="ng_slicknavmenu[ng_slicknav_background]" value="' . sanitize_text_field($options['ng_slicknav_background']) . '"/>';
}
/**
* Menu button color
*
* @since 1.8.0
*/
function ng_slicknav_button_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_button'] ) ) $options['ng_slicknav_button'] = '#222222';
echo '<input type="text" class="color-picker" data-alpha-enabled="true" data-default-color="#222" name="ng_slicknavmenu[ng_slicknav_button]" value="' . sanitize_text_field($options['ng_slicknav_button']) . '"/>';
}
/**
* Logo Text Color
*
* @since 1.8.0
*/
function ng_slicknav_brand_text_color_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_brand_text_color'] ) ) $options['ng_slicknav_brand_text_color'] = '#222222';
echo '<input type="text" class="color-picker" data-alpha-enabled="true" data-default-color="#222" name="ng_slicknavmenu[ng_slicknav_brand_text_color]" value="' . sanitize_text_field($options['ng_slicknav_brand_text_color']) . '"/>';
}
/**
* Menu button expand color
*
* @since 1.8.0
*/
function ng_slicknav_button_expand_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_button_expand'] ) ) $options['ng_slicknav_button_expand'] = '#222222';
echo '<input type="text" class="color-picker" data-alpha-enabled="true" data-default-color="#222222" name="ng_slicknavmenu[ng_slicknav_button_expand]" value="' . sanitize_text_field($options['ng_slicknav_button_expand']) . '"/>';
}
/**
* Label color
*
* @since 1.8.0
*/
function ng_slicknav_label_color_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_label_color'] ) ) $options['ng_slicknav_label_color'] = '#fff';
echo '<input type="text" class="color-picker" data-alpha-enabled="true" data-default-color="#fff" name="ng_slicknavmenu[ng_slicknav_label_color]" value="' . sanitize_text_field($options['ng_slicknav_label_color']) . '"/>';
}
/**
* Icon color
*
* @since 1.8.0
*/
function ng_slicknav_icon_color_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_icon_color'] ) ) $options['ng_slicknav_icon_color'] = '#fff';
echo '<input type="text" class="color-picker" data-alpha-enabled="true" data-default-color="#fff" name="ng_slicknavmenu[ng_slicknav_icon_color]" value="' . sanitize_text_field($options['ng_slicknav_icon_color']) . '"/>';
}
/**
* Link color
*
* @since 1.8.0
*/
function ng_slicknav_link_color_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_link_color'] ) ) $options['ng_slicknav_link_color'] = '#fff';
echo '<input type="text" class="color-picker" data-alpha-enabled="true" data-default-color="rgba(0,0,0,0.85)" name="ng_slicknavmenu[ng_slicknav_link_color]" value="' . sanitize_text_field($options['ng_slicknav_link_color']) . '"/>';
}
/**
* Link hover color
*
* @since 1.8.0
*/
function ng_slicknav_link_hover_color_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_link_hover_color'] ) ) $options['ng_slicknav_link_hover_color'] = '#222222';
echo '<input type="text" class="color-picker" data-alpha-enabled="true" data-default-color="#222222" name="ng_slicknavmenu[ng_slicknav_link_hover_color]" value="' . sanitize_text_field($options['ng_slicknav_link_hover_color']) . '"/>';
}
/**
* Link background hover color
*
* @since 1.8.0
*/
function ng_slicknav_link_hover_background_color_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_link_hover_background_color'] ) ) $options['ng_slicknav_link_hover_background_color'] = 'rgba(204,204,204,0.3)';
echo '<input type="text" class="color-picker" data-alpha-enabled="true" data-default-color="rgba(204,204,204,0.3)" name="ng_slicknavmenu[ng_slicknav_link_hover_background_color]" value="' . sanitize_text_field($options['ng_slicknav_link_hover_background_color']) . '"/>';
}
/**
* Show Search Field
*
* @since 1.8.0
*/
function ng_slicknav_search_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_search'] ) ) $options['ng_slicknav_search'] = '';
?>
<fieldset>
<label for="ng_slicknav_search">
<input name="ng_slicknavmenu[ng_slicknav_search]" type="checkbox" id="ng_slicknav_search" value="1"<?php checked( 1, $options['ng_slicknav_search'], true ); ?> />
<span class="description"><?php esc_attr_e( 'Show Search Field', 'slicknav-mobile-menu' ); ?></span>
</label>
</fieldset>
<?php
}
/**
* Search Text
*
* @since 1.8.0
*/
function ng_slicknav_search_text_callback() {
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_search_text'] ) ) $options['ng_slicknav_search_text'] = 'search...';
echo '<input type="text" id="ng_slicknav_search_text" name="ng_slicknavmenu[ng_slicknav_search_text]" value="' . sanitize_text_field($options['ng_slicknav_search_text']) . '" placeholder="search..." class="medium-text" />';
}
/**
* Search icon color
*
* @since 1.8.0
*/
function ng_slicknav_search_icon_color_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_search_icon_color'] ) ) $options['ng_slicknav_search_icon_color'] = '#fff';
echo '<input type="text" class="color-picker" data-alpha-enabled="true" data-default-color="#fff" name="ng_slicknavmenu[ng_slicknav_search_icon_color]" value="' . sanitize_text_field($options['ng_slicknav_search_icon_color']) . '"/>';
}
/**
* Search icon color background
*
* @since 1.8.0
*/
function ng_slicknav_search_color_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_search_color'] ) ) $options['ng_slicknav_search_color'] = '#222222';
echo '<input type="text" class="color-picker" data-alpha-enabled="true" data-default-color="#222222" name="ng_slicknavmenu[ng_slicknav_search_color]" value="' . sanitize_text_field($options['ng_slicknav_search_color']) . '"/>';
}
/**
* Label Shadow
*
* @since 1.8.0
*/
function ng_slicknav_label_shadow_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_label_shadow'] ) ) $options['ng_slicknav_label_shadow'] = '';
?>
<fieldset>
<label for="ng_slicknav_label_shadow">
<input name="ng_slicknavmenu[ng_slicknav_label_shadow]" type="checkbox" id="ng_slicknav_label_shadow" value="1"<?php checked( 1, $options['ng_slicknav_label_shadow'], true ); ?> />
<span class="description"><?php esc_attr_e( 'Add label shadow', 'slicknav-mobile-menu' ); ?></span>
</label>
</fieldset>
<?php
}
/**
* Icon shadow
*
* @since 1.8.0
*/
function ng_slicknav_icon_shadow_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_icon_shadow'] ) ) $options['ng_slicknav_icon_shadow'] = '';
?>
<fieldset>
<label for="ng_slicknav_icon_shadow">
<input name="ng_slicknavmenu[ng_slicknav_icon_shadow]" type="checkbox" id="ng_slicknav_icon_shadow" value="1"<?php checked( 1, $options['ng_slicknav_icon_shadow'], true ); ?> />
<span class="description"><?php esc_attr_e( 'Add icon shadow', 'slicknav-mobile-menu' ); ?></span>
</label>
</fieldset>
<?php
}
/**
* Menu Position
*
* @since 1.8.0
*/
function ng_slicknav_button_position_callback() {
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_button_position'] ) ) $options['ng_slicknav_button_position'] = 'right';
?>
<fieldset>
<label title='g:i a'>
<input type="radio" name="ng_slicknavmenu[ng_slicknav_button_position]" value="flex-end"<?php checked( 'flex-end', $options['ng_slicknav_button_position'], true ); ?> />
<span><?php esc_attr_e( 'Right', 'slicknav-mobile-menu' ); ?></span>
</label><br>
<label title='g:i a'>
<input type="radio" name="ng_slicknavmenu[ng_slicknav_button_position]" value="center"<?php checked( 'center', $options['ng_slicknav_button_position'], true ); ?> />
<span><?php esc_attr_e( 'Center', 'slicknav-mobile-menu' ); ?></span>
</label><br>
<label title='g:i a'>
<input type="radio" name="ng_slicknavmenu[ng_slicknav_button_position]" value="flex-start"<?php checked( 'flex-start', $options['ng_slicknav_button_position'], true ); ?> />
<span><?php esc_attr_e( 'Left', 'slicknav-mobile-menu' ); ?></span>
</label>
</fieldset>
<?php
}
/**
* Menu Position
*
* @since 1.8.0
*/
function ng_slicknav_submenu_position_callback() {
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_submenu_position'] ) ) $options['ng_slicknav_submenu_position'] = 'right';
?>
<fieldset>
<label title='g:i a'>
<input type="radio" name="ng_slicknavmenu[ng_slicknav_submenu_position]" value="right"<?php checked( 'right', $options['ng_slicknav_submenu_position'], true ); ?> />
<span><?php esc_attr_e( 'Right', 'slicknav-mobile-menu' ); ?></span>
</label><br>
<label title='g:i a'>
<input type="radio" name="ng_slicknavmenu[ng_slicknav_submenu_position]" value="none"<?php checked( 'none', $options['ng_slicknav_submenu_position'], true ); ?> />
<span><?php esc_attr_e( 'Left', 'slicknav-mobile-menu' ); ?></span>
</label>
</fieldset>
<?php
}
/**
* Menu Label Weight
*
* @since 1.8.0
*/
function ng_slicknav_label_weight_callback() {
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_label_weight'] ) ) $options['ng_slicknav_label_weight'] = 'normal';
?>
<select name="ng_slicknavmenu[ng_slicknav_label_weight]" id="ng_slicknav_label_weight">
<option value="normal"<?php selected($options['ng_slicknav_label_weight'], 'normal'); ?> >Normal</option>
<option value="bold"<?php selected ($options['ng_slicknav_label_weight'], 'bold'); ?> >Bold</option>
</select>
<?php
}
/**
* Font Case
*
* @since 1.8.0
*/
function ng_slicknav_font_case_callback() {
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_font_case'] ) ) $options['ng_slicknav_font_case'] = 'none';
?>
<select name="ng_slicknavmenu[ng_slicknav_font_case]" id="ng_slicknav_font_case">
<option value="none"<?php selected($options['ng_slicknav_font_case'], 'none'); ?> >None</option>
<option value="capitalize"<?php selected ($options['ng_slicknav_font_case'], 'capitalize'); ?> >Capitalize</option>
<option value="lowercase"<?php selected ($options['ng_slicknav_font_case'], 'lowercase'); ?> >Lowercase</option>
<option value="uppercase"<?php selected ($options['ng_slicknav_font_case'], 'uppercase'); ?> >Uppercase</option>
</select>
<?php
}
/**
* Menu position
*
* @since 1.8.0
*/
function ng_slicknav_position_callback() {
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_position'] ) ) $options['ng_slicknav_position'] = 'body';
echo '<input type="text" id="ng_slicknav_position" name="ng_slicknavmenu[ng_slicknav_position]" value="' . sanitize_text_field($options['ng_slicknav_position']) . '" placeholder="body" class="medium-text" />';
echo '<span class="description">' . __( 'Menu Position (body by default, using body puts the Menu at the top.
However you can adjust this location by adding in a CSS class','slicknav-mobile-menu') . '</span>';
}
/**
* Menu position
*
* @since 1.8.0
*/
function ng_slicknav_label_callback() {
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_label'] ) ) $options['ng_slicknav_label'] = 'MENU';
echo '<input type="text" id="ng_slicknav_label" name="ng_slicknavmenu[ng_slicknav_label]" value="' . sanitize_text_field($options['ng_slicknav_label']) . '" placeholder="MENU" class="medium-text" />';
echo '<span class="description">' . __( 'Menu Label ("MENU" by default, leave blank for no label and just the symbol)') . '</span>';
}
/**
* Close on click option
*
* @since 1.8.0
*/
function ng_slicknav_close_click_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_close_click'] ) ) $options['ng_slicknav_close_click'] = '';
?>
<fieldset>
<label for="ng_slicknav_close_click">
<input name="ng_slicknavmenu[ng_slicknav_close_click]" type="checkbox" id="ng_slicknav_close_click" value="1"<?php checked( 1, $options['ng_slicknav_close_click'], true ); ?> />
<span class="description"><?php esc_attr_e( 'Close menu on click', 'slicknav-mobile-menu' ); ?></span>
</label>
</fieldset>
<?php
}
/**
* Allow parent links
*
* @since 1.8.0
*/
function ng_slicknav_parent_links_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_parent_links'] ) ) $options['ng_slicknav_parent_links'] = '';
?>
<fieldset>
<label for="ng_slicknav_parent_links">
<input name="ng_slicknavmenu[ng_slicknav_parent_links]" type="checkbox" id="ng_slicknav_parent_links" value="1"<?php checked( 1, $options['ng_slicknav_parent_links'], true ); ?> />
<span class="description"><?php esc_attr_e( 'Allow Parent Links', 'slicknav-mobile-menu' ); ?></span>
</label>
</fieldset>
<?php
}
/**
* Show Child Links on Open
*
* @since 1.8.0
*/
function ng_slicknav_child_links_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_child_links'] ) ) $options['ng_slicknav_child_links'] = '';
?>
<fieldset>
<label for="ng_slicknav_child_links">
<input name="ng_slicknavmenu[ng_slicknav_child_links]" type="checkbox" id="ng_slicknav_child_links" value="1"<?php checked( 1, $options['ng_slicknav_child_links'], true ); ?> />
<span class="description"><?php esc_attr_e( 'Show Child Links on Open', 'slicknav-mobile-menu' ); ?></span>
</label>
</fieldset>
<?php
}
/**
* Toggle One SubMenu at a time
*
* @since 1.8.0
*/
function ng_slicknav_accordion_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_accordion'] ) ) $options['ng_slicknav_accordion'] = '';
?>
<fieldset>
<label for="ng_slicknav_accordion">
<input name="ng_slicknavmenu[ng_slicknav_accordion]" type="checkbox" id="ng_slicknav_accordion" value="1"<?php checked( 1, $options['ng_slicknav_accordion'], true ); ?> />
<span class="description"><?php esc_attr_e( 'Toggle sub menus so only one is open at a time', 'slicknav-mobile-menu' ); ?></span>
</label>
</fieldset>
<?php
}
/**
* Hide Menu on Desktop
*
* @since 1.8.0
*/
function ng_slicknav_hidedesktop_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_hidedesktop'] ) ) $options['ng_slicknav_hidedesktop'] = 'block';
?>
<select name="ng_slicknavmenu[ng_slicknav_hidedesktop]" id="ng_slicknav_hidedesktop">
<option value="block"<?php selected($options['ng_slicknav_hidedesktop'], 'block'); ?> >block</option>
<option value="inline-block"<?php selected($options['ng_slicknav_hidedesktop'], 'inline-block'); ?> >inline-block</option>
<option value="inline"<?php selected ($options['ng_slicknav_hidedesktop'], 'inline'); ?> >inline</option>
<option value="flex"<?php selected ($options['ng_slicknav_hidedesktop'], 'flex'); ?> >flex</option>
<option value="none"<?php selected ($options['ng_slicknav_hidedesktop'], 'none'); ?> >none</option>
</select>
<?php
}
/**
* Fix menu to head
*
* @since 1.8.0
*/
function ng_slicknav_fixhead_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_fixhead'] ) ) $options['ng_slicknav_fixhead'] = '';
?>
<fieldset>
<label for="ng_slicknav_fixhead">
<input name="ng_slicknavmenu[ng_slicknav_fixhead]" type="checkbox" id="ng_slicknav_fixhead" value="1"<?php checked( 1, $options['ng_slicknav_fixhead'], true ); ?> />
<span class="description"><?php esc_attr_e( 'Fix menu to head', 'slicknav-mobile-menu' ); ?></span>
</label>
</fieldset>
<?php
}
/**
* Hide main header at mobile size
*
* @since 1.8.0
*/
function ng_slicknav_header_callback(){
$options = get_option( 'ng_slicknavmenu' );
if( !isset( $options['ng_slicknav_header'] ) ) $options['ng_slicknav_header'] = '';
?>
<fieldset>
<label for="ng_slicknav_header">
<input name="ng_slicknavmenu[ng_slicknav_header]" type="checkbox" id="ng_slicknav_header" value="1"<?php checked( 1, $options['ng_slicknav_header'], true ); ?> />
<span class="description"><?php esc_attr_e( 'Hide Main Header in Mobile View', 'slicknav-mobile-menu' ); ?></span>
</label>
</fieldset>