mystickymenu
Last commit date
js
11 years ago
languages
11 years ago
mystickymenu.php
11 years ago
readme.txt
11 years ago
mystickymenu.php
498 lines
| 1 | <?php |
| 2 | /* |
| 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 |
| 7 | Author: m.r.d.a |
| 8 | Text domain: mystickymenu |
| 9 | Domain Path: /languages |
| 10 | License: GPLv2 or later |
| 11 | */ |
| 12 | |
| 13 | // Block direct acess to the file |
| 14 | defined('ABSPATH') or die("Cannot access pages directly."); |
| 15 | |
| 16 | // Add plugin admin settings by Otto |
| 17 | class MyStickyMenuPage |
| 18 | { |
| 19 | /** |
| 20 | * Holds the values to be used in the fields callbacks |
| 21 | */ |
| 22 | private $options; |
| 23 | |
| 24 | /** |
| 25 | * Start up |
| 26 | */ |
| 27 | public function __construct() |
| 28 | { |
| 29 | add_action( 'admin_menu', array( $this, 'add_plugin_page' ) ); |
| 30 | add_action( 'admin_init', array( $this, 'mysticky_load_transl') ); |
| 31 | add_action( 'admin_init', array( $this, 'page_init' ) ); |
| 32 | add_action( 'admin_init', array( $this, 'mysticky_default_options' ) ); |
| 33 | add_action( 'admin_enqueue_scripts', array( $this, 'mysticky_enqueue_color_picker' ) ); |
| 34 | } |
| 35 | |
| 36 | public function mysticky_load_transl() |
| 37 | { |
| 38 | load_plugin_textdomain('mystickymenu', FALSE, dirname(plugin_basename(__FILE__)).'/languages/'); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Add options page |
| 43 | */ |
| 44 | public function add_plugin_page() |
| 45 | { |
| 46 | // This page will be under "Settings" |
| 47 | add_options_page( |
| 48 | 'Settings Admin', |
| 49 | 'myStickymenu', |
| 50 | 'manage_options', |
| 51 | 'my-stickymenu-settings', |
| 52 | array( $this, 'create_admin_page' ) |
| 53 | ); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Options page callback |
| 58 | */ |
| 59 | public function create_admin_page() |
| 60 | { |
| 61 | // Set class property |
| 62 | $this->options = get_option( 'mysticky_option_name'); |
| 63 | ?> |
| 64 | <div class="wrap"> |
| 65 | <?php screen_icon(); ?> |
| 66 | <h2><?php _e('myStickymenu Settings', 'mystickymenu'); ?></h2> |
| 67 | <form method="post" action="options.php"> |
| 68 | <?php |
| 69 | // This prints out all hidden setting fields |
| 70 | settings_fields( 'mysticky_option_group' ); |
| 71 | do_settings_sections( 'my-stickymenu-settings' ); |
| 72 | submit_button(); |
| 73 | ?> |
| 74 | </form> |
| 75 | </div> |
| 76 | <?php |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Register and add settings |
| 81 | */ |
| 82 | public function page_init() |
| 83 | { |
| 84 | global $id, $title, $callback, $page; |
| 85 | register_setting( |
| 86 | 'mysticky_option_group', // Option group |
| 87 | 'mysticky_option_name', // Option name |
| 88 | array( $this, 'sanitize' ) // Sanitize |
| 89 | ); |
| 90 | |
| 91 | add_settings_field( $id, $title, $callback, $page, $section = 'default', $args = array() ); |
| 92 | |
| 93 | add_settings_section( |
| 94 | 'setting_section_id', // ID |
| 95 | __("myStickymenu Options", 'mystickymenu'), // Title |
| 96 | array( $this, 'print_section_info' ), // Callback |
| 97 | 'my-stickymenu-settings' // Page |
| 98 | ); |
| 99 | |
| 100 | add_settings_field( |
| 101 | 'mysticky_class_selector', // ID |
| 102 | __("Sticky Class", 'mystickymenu'), // Title |
| 103 | array( $this, 'mysticky_class_selector_callback' ), // Callback |
| 104 | 'my-stickymenu-settings', // Page |
| 105 | 'setting_section_id' // Section |
| 106 | ); |
| 107 | |
| 108 | add_settings_field( |
| 109 | 'myfixed_zindex', |
| 110 | __("Sticky z-index", 'mystickymenu'), |
| 111 | array( $this, 'myfixed_zindex_callback' ), |
| 112 | 'my-stickymenu-settings', |
| 113 | 'setting_section_id' |
| 114 | ); |
| 115 | |
| 116 | add_settings_field( |
| 117 | 'myfixed_bgcolor', |
| 118 | __("Sticky Background Color", 'mystickymenu'), |
| 119 | array( $this, 'myfixed_bgcolor_callback' ), |
| 120 | 'my-stickymenu-settings', |
| 121 | 'setting_section_id' |
| 122 | ); |
| 123 | |
| 124 | add_settings_field( |
| 125 | 'myfixed_opacity', |
| 126 | __("Sticky Opacity", 'mystickymenu'), |
| 127 | array( $this, 'myfixed_opacity_callback' ), |
| 128 | 'my-stickymenu-settings', |
| 129 | 'setting_section_id' |
| 130 | ); |
| 131 | |
| 132 | add_settings_field( |
| 133 | 'myfixed_transition_time', |
| 134 | __("Sticky Transition Time", 'mystickymenu'), |
| 135 | array( $this, 'myfixed_transition_time_callback' ), |
| 136 | 'my-stickymenu-settings', |
| 137 | 'setting_section_id' |
| 138 | ); |
| 139 | |
| 140 | add_settings_field( |
| 141 | 'myfixed_disable_small_screen', |
| 142 | __("Disable at Small Screen Sizes", 'mystickymenu'), |
| 143 | array( $this, 'myfixed_disable_small_screen_callback' ), |
| 144 | 'my-stickymenu-settings', |
| 145 | 'setting_section_id' |
| 146 | ); |
| 147 | |
| 148 | add_settings_field( |
| 149 | 'mysticky_active_on_height', |
| 150 | __("Make visible when scroled", 'mystickymenu'), |
| 151 | array( $this, 'mysticky_active_on_height_callback' ), |
| 152 | 'my-stickymenu-settings', |
| 153 | 'setting_section_id' |
| 154 | ); |
| 155 | |
| 156 | add_settings_field( |
| 157 | 'mysticky_active_on_height_home', |
| 158 | __("Make visible when scroled on homepage", 'mystickymenu'), |
| 159 | array( $this, 'mysticky_active_on_height_home_callback' ), |
| 160 | 'my-stickymenu-settings', |
| 161 | 'setting_section_id' |
| 162 | ); |
| 163 | |
| 164 | add_settings_field( |
| 165 | 'myfixed_fade', |
| 166 | __("Fade or slide effect", 'mystickymenu'), |
| 167 | array( $this, 'myfixed_fade_callback' ), |
| 168 | 'my-stickymenu-settings', |
| 169 | 'setting_section_id' |
| 170 | ); |
| 171 | |
| 172 | add_settings_field( |
| 173 | 'myfixed_cssstyle', |
| 174 | __(".myfixed css class", 'mystickymenu'), |
| 175 | array( $this, 'myfixed_cssstyle_callback' ), |
| 176 | 'my-stickymenu-settings', |
| 177 | 'setting_section_id' |
| 178 | ); |
| 179 | } |
| 180 | /** |
| 181 | * Sanitize each setting field as needed |
| 182 | * |
| 183 | * @param array $input Contains all settings fields as array keys |
| 184 | */ |
| 185 | public function sanitize( $input ) |
| 186 | { |
| 187 | $new_input = array(); |
| 188 | if( isset( $input['mysticky_class_selector'] ) ) |
| 189 | $new_input['mysticky_class_selector'] = sanitize_text_field( $input['mysticky_class_selector'] ); |
| 190 | |
| 191 | if( isset( $input['myfixed_zindex'] ) ) |
| 192 | $new_input['myfixed_zindex'] = absint( $input['myfixed_zindex'] ); |
| 193 | |
| 194 | if( isset( $input['myfixed_bgcolor'] ) ) |
| 195 | $new_input['myfixed_bgcolor'] = sanitize_text_field( $input['myfixed_bgcolor'] ); |
| 196 | |
| 197 | if( isset( $input['myfixed_opacity'] ) ) |
| 198 | $new_input['myfixed_opacity'] = absint( $input['myfixed_opacity'] ); |
| 199 | |
| 200 | if( isset( $input['myfixed_transition_time'] ) ) |
| 201 | $new_input['myfixed_transition_time'] = sanitize_text_field( $input['myfixed_transition_time'] ); |
| 202 | |
| 203 | if( isset( $input['myfixed_disable_small_screen'] ) ) |
| 204 | $new_input['myfixed_disable_small_screen'] = absint( $input['myfixed_disable_small_screen'] ); |
| 205 | |
| 206 | if( isset( $input['mysticky_active_on_height'] ) ) |
| 207 | $new_input['mysticky_active_on_height'] = absint( $input['mysticky_active_on_height'] ); |
| 208 | |
| 209 | if( isset( $input['mysticky_active_on_height_home'] ) ) |
| 210 | $new_input['mysticky_active_on_height_home'] = absint( $input['mysticky_active_on_height_home'] ); |
| 211 | |
| 212 | if( isset( $input['myfixed_fade'] ) ) |
| 213 | $new_input['myfixed_fade'] = sanitize_text_field( $input['myfixed_fade'] ); |
| 214 | |
| 215 | if( isset( $input['myfixed_cssstyle'] ) ) |
| 216 | $new_input['myfixed_cssstyle'] = sanitize_text_field( $input['myfixed_cssstyle'] ); |
| 217 | |
| 218 | return $new_input; |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * Load Defaults |
| 223 | */ |
| 224 | public function mysticky_default_options() { |
| 225 | |
| 226 | global $options; |
| 227 | |
| 228 | $default = array( |
| 229 | |
| 230 | 'mysticky_class_selector' => '.navbar', |
| 231 | 'myfixed_zindex' => '1000000', |
| 232 | 'myfixed_bgcolor' => '#F39A30', |
| 233 | 'myfixed_opacity' => '95', |
| 234 | 'myfixed_transition_time' => '0.3', |
| 235 | 'myfixed_disable_small_screen' => '359', |
| 236 | 'mysticky_active_on_height' => '320', |
| 237 | 'mysticky_active_on_height_home' => '320', |
| 238 | 'myfixed_fade' => false, |
| 239 | 'myfixed_cssstyle' => '.myfixed { margin:0 auto!important; float:none!important; border:0px!important; background:none!important; max-width:100%!important; }' |
| 240 | ); |
| 241 | |
| 242 | if ( get_option('mysticky_option_name') == false ) { |
| 243 | update_option( 'mysticky_option_name', $default ); |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | public function mysticky_enqueue_color_picker( ) |
| 248 | { |
| 249 | wp_enqueue_style( 'wp-color-picker' ); |
| 250 | wp_enqueue_script( 'my-script-handle', plugins_url('js/iris-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true ); |
| 251 | } |
| 252 | |
| 253 | /** |
| 254 | * Print the Section text |
| 255 | */ |
| 256 | public function print_section_info() |
| 257 | { |
| 258 | echo __("Add nice modern sticky menu or header to any theme. Defaults works for Twenty Thirteen theme. <br />For other themes change 'Sticky Class' to div class desired to be sticky (div id can be used too).", 'mystickymenu'); |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * Get the settings option array and print one of its values |
| 263 | */ |
| 264 | public function mysticky_class_selector_callback() |
| 265 | { |
| 266 | printf( |
| 267 | '<p class="description"><input type="text" size="8" id="mysticky_class_selector" name="mysticky_option_name[mysticky_class_selector]" value="%s" /> ', |
| 268 | isset( $this->options['mysticky_class_selector'] ) ? esc_attr( $this->options['mysticky_class_selector']) : '' |
| 269 | ); |
| 270 | echo __("menu or header div class or id.", 'mystickymenu'); |
| 271 | echo '</p>'; |
| 272 | } |
| 273 | |
| 274 | public function myfixed_zindex_callback() |
| 275 | { |
| 276 | printf( |
| 277 | '<p class="description"><input type="number" min="0" max="2147483647" step="1" id="myfixed_zindex" name="mysticky_option_name[myfixed_zindex]" value="%s" /></p>', |
| 278 | isset( $this->options['myfixed_zindex'] ) ? esc_attr( $this->options['myfixed_zindex']) : '' |
| 279 | ); |
| 280 | } |
| 281 | |
| 282 | public function myfixed_bgcolor_callback() |
| 283 | { |
| 284 | printf( |
| 285 | '<p class="description"><input type="text" id="myfixed_bgcolor" name="mysticky_option_name[myfixed_bgcolor]" class="my-color-field" value="%s" /></p> ' , |
| 286 | isset( $this->options['myfixed_bgcolor'] ) ? esc_attr( $this->options['myfixed_bgcolor']) : '' |
| 287 | ); |
| 288 | } |
| 289 | |
| 290 | public function myfixed_opacity_callback() |
| 291 | { |
| 292 | printf( |
| 293 | '<p class="description"><input type="number" class="small-text" min="0" step="1" max="100" id="myfixed_opacity" name="mysticky_option_name[myfixed_opacity]" value="%s" /> ', |
| 294 | isset( $this->options['myfixed_opacity'] ) ? esc_attr( $this->options['myfixed_opacity']) : '' |
| 295 | ); |
| 296 | echo __("numbers 1-100.", 'mystickymenu'); |
| 297 | echo '</p>'; |
| 298 | } |
| 299 | |
| 300 | public function myfixed_transition_time_callback() |
| 301 | { |
| 302 | printf( |
| 303 | '<p class="description"><input type="number" class="small-text" min="0" step="0.1" id="myfixed_transition_time" name="mysticky_option_name[myfixed_transition_time]" value="%s" /> ', |
| 304 | isset( $this->options['myfixed_transition_time'] ) ? esc_attr( $this->options['myfixed_transition_time']) : '' |
| 305 | ); |
| 306 | echo __("in seconds.", 'mystickymenu'); |
| 307 | echo '</p>'; |
| 308 | } |
| 309 | |
| 310 | public function myfixed_disable_small_screen_callback() |
| 311 | { |
| 312 | printf( |
| 313 | '<p class="description">' |
| 314 | ); |
| 315 | echo __("less than", 'mystickymenu'); |
| 316 | printf( |
| 317 | ' <input type="number" class="small-text" min="0" step="1" id="myfixed_disable_small_screen" name="mysticky_option_name[myfixed_disable_small_screen]" value="%s" />', |
| 318 | isset( $this->options['myfixed_disable_small_screen'] ) ? esc_attr( $this->options['myfixed_disable_small_screen']) : '' |
| 319 | ); |
| 320 | echo __("px width, 0 to disable.", 'mystickymenu'); |
| 321 | echo '</p>'; |
| 322 | } |
| 323 | |
| 324 | public function mysticky_active_on_height_callback() |
| 325 | { |
| 326 | printf( |
| 327 | '<p class="description">' |
| 328 | ); |
| 329 | echo __("after", 'mystickymenu'); |
| 330 | printf( |
| 331 | ' <input type="number" class="small-text" min="0" step="1" id="mysticky_active_on_height" name="mysticky_option_name[mysticky_active_on_height]" value="%s" />', |
| 332 | isset( $this->options['mysticky_active_on_height'] ) ? esc_attr( $this->options['mysticky_active_on_height']) : '' |
| 333 | ); |
| 334 | echo __("px. (scroll)", 'mystickymenu'); |
| 335 | echo '</p>'; |
| 336 | } |
| 337 | |
| 338 | public function mysticky_active_on_height_home_callback() |
| 339 | { |
| 340 | printf( |
| 341 | '<p class="description">' |
| 342 | ); |
| 343 | echo __("after", 'mystickymenu'); |
| 344 | printf( |
| 345 | ' <input type="number" class="small-text" min="0" step="1" id="mysticky_active_on_height_home" name="mysticky_option_name[mysticky_active_on_height_home]" value="%s" />', |
| 346 | isset( $this->options['mysticky_active_on_height_home'] ) ? esc_attr( $this->options['mysticky_active_on_height_home']) : '' |
| 347 | ); |
| 348 | echo __("px. (scroll)", 'mystickymenu'); |
| 349 | echo '</p>'; |
| 350 | } |
| 351 | |
| 352 | public function myfixed_fade_callback() |
| 353 | { |
| 354 | printf( |
| 355 | '<p class="description"><input id="%1$s" name="mysticky_option_name[myfixed_fade]" type="checkbox" %2$s /> ', |
| 356 | 'myfixed_fade', |
| 357 | checked( isset( $this->options['myfixed_fade'] ), true, false ) |
| 358 | ); |
| 359 | echo __("Checked is slide, unchecked is fade.", 'mystickymenu'); |
| 360 | echo '</p>'; |
| 361 | } |
| 362 | |
| 363 | public function myfixed_cssstyle_callback() |
| 364 | { |
| 365 | printf( |
| 366 | '<p class="description">' |
| 367 | ); |
| 368 | echo __("Add/Edit .myfixed css class to change sticky menu style. Leave it blank for default style.", 'mystickymenu'); |
| 369 | echo '</p>'; |
| 370 | printf( |
| 371 | '<textarea type="text" rows="4" cols="60" id="myfixed_cssstyle" name="mysticky_option_name[myfixed_cssstyle]">%s</textarea> <br />', |
| 372 | isset( $this->options['myfixed_cssstyle'] ) ? esc_attr( $this->options['myfixed_cssstyle']) : '' |
| 373 | ); |
| 374 | echo '<p class="description">'; |
| 375 | echo __("Default style: ", 'mystickymenu'); |
| 376 | echo '.myfixed { margin:0 auto!important; float:none!important; border:0px!important; background:none!important; max-width:100%!important; }<br /><br />'; |
| 377 | echo __("If you want to change sticky hover color first add default style and than: ", 'mystickymenu'); |
| 378 | echo '.myfixed li a:hover {color:#000; background-color: #ccc;}<br />'; |
| 379 | echo __("More examples <a href='http://wordpress.transformnews.com/tutorials/mystickymenu-extended-style-functionality-using-myfixed-sticky-class-403'>here</a>.", 'mystickymenu'); |
| 380 | echo'</p>'; |
| 381 | } |
| 382 | |
| 383 | } |
| 384 | |
| 385 | if( is_admin() ) |
| 386 | $my_settings_page = new MyStickyMenuPage(); |
| 387 | |
| 388 | // end plugin admin settings |
| 389 | |
| 390 | // Remove default option for more link that jumps at the midle of page and its covered by menu |
| 391 | |
| 392 | function mysticky_remove_more_jump_link($link) |
| 393 | { |
| 394 | $offset = strpos($link, '#more-'); |
| 395 | if ($offset) { |
| 396 | $end = strpos($link, '"',$offset); |
| 397 | } |
| 398 | if ($end) { |
| 399 | $link = substr_replace($link, '', $offset, $end-$offset); |
| 400 | } |
| 401 | return $link; |
| 402 | } |
| 403 | |
| 404 | add_filter('the_content_more_link', 'mysticky_remove_more_jump_link'); |
| 405 | |
| 406 | // Create style from options |
| 407 | |
| 408 | function mysticky_build_stylesheet_content() { |
| 409 | |
| 410 | $mysticky_options = get_option( 'mysticky_option_name' ); |
| 411 | |
| 412 | echo |
| 413 | '<style type="text/css">'; |
| 414 | if ( is_user_logged_in() ) { |
| 415 | |
| 416 | echo '#wpadminbar { position: absolute !important; top: 0px !important;}'; |
| 417 | } |
| 418 | |
| 419 | if ( $mysticky_options['myfixed_cssstyle'] == "" ) { |
| 420 | echo '.myfixed { margin:0 auto!important; float:none!important; border:0px!important; background:none!important; max-width:100%!important; }'; |
| 421 | } |
| 422 | echo |
| 423 | $mysticky_options ['myfixed_cssstyle'] ; |
| 424 | echo |
| 425 | ' |
| 426 | #mysticky-nav { width:100%!important; position: static;'; |
| 427 | |
| 428 | if (isset($mysticky_options['myfixed_fade'])){ |
| 429 | |
| 430 | echo |
| 431 | 'top: -100px;'; |
| 432 | } |
| 433 | echo |
| 434 | '}'; |
| 435 | |
| 436 | if ($mysticky_options ['myfixed_opacity'] == 100 ){ |
| 437 | |
| 438 | echo |
| 439 | '.wrapfixed { position: fixed!important; top:0px!important; left: 0px!important; margin-top:0px!important; z-index: '. $mysticky_options ['myfixed_zindex'] .'; -webkit-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; -moz-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; -o-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; background-color: ' . $mysticky_options ['myfixed_bgcolor'] . '!important; } |
| 440 | '; |
| 441 | } |
| 442 | |
| 443 | if ($mysticky_options ['myfixed_opacity'] < 100 ){ |
| 444 | |
| 445 | echo |
| 446 | '.wrapfixed { position: fixed!important; top:0px!important; left: 0px!important; margin-top:0px!important; z-index: '. $mysticky_options ['myfixed_zindex'] .'; -webkit-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; -moz-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; -o-transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; transition: ' . $mysticky_options ['myfixed_transition_time'] . 's; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . $mysticky_options ['myfixed_opacity'] . ')"; filter: alpha(opacity=' . $mysticky_options ['myfixed_opacity'] . '); opacity:.' . $mysticky_options ['myfixed_opacity'] . '; background-color: ' . $mysticky_options ['myfixed_bgcolor'] . '!important; } |
| 447 | '; |
| 448 | } |
| 449 | |
| 450 | if ($mysticky_options ['myfixed_disable_small_screen'] > 0 ){ |
| 451 | |
| 452 | echo |
| 453 | '@media (max-width: ' . $mysticky_options ['myfixed_disable_small_screen'] . 'px) {.wrapfixed {position: static!important; display: none!important;}} |
| 454 | '; |
| 455 | } |
| 456 | echo |
| 457 | '</style> |
| 458 | '; |
| 459 | } |
| 460 | |
| 461 | add_action('wp_head', 'mysticky_build_stylesheet_content'); |
| 462 | |
| 463 | function mystickymenu_script() { |
| 464 | |
| 465 | $mysticky_options = get_option( 'mysticky_option_name' ); |
| 466 | |
| 467 | // needed for update 1.7 => 1.8 ... will be removed in the future () |
| 468 | if (isset($mysticky_options['mysticky_active_on_height_home'])){ |
| 469 | //do nothing |
| 470 | } else { |
| 471 | $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height']; |
| 472 | }; |
| 473 | |
| 474 | // if set to 0 => display default active_on_height |
| 475 | if ($mysticky_options['mysticky_active_on_height_home'] == 0 ){ |
| 476 | $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height']; |
| 477 | }; |
| 478 | |
| 479 | if ( is_home() ) { |
| 480 | $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home']; |
| 481 | }; |
| 482 | |
| 483 | // Register scripts |
| 484 | wp_register_script('mystickymenu', WP_PLUGIN_URL. '/mystickymenu/js/mystickymenu.js', false,'1.0.0', true); |
| 485 | wp_enqueue_script( 'mystickymenu' ); |
| 486 | |
| 487 | // Localize mystickymenu.js script with myStickymenu options |
| 488 | $mysticky_translation_array = array( |
| 489 | 'mysticky_string' => $mysticky_options['mysticky_class_selector'] , |
| 490 | 'mysticky_active_on_height_string' => $mysticky_options['mysticky_active_on_height'], |
| 491 | 'mysticky_disable_at_width_string' => $mysticky_options['myfixed_disable_small_screen'] |
| 492 | ); |
| 493 | |
| 494 | wp_localize_script( 'mystickymenu', 'mysticky_name', $mysticky_translation_array ); |
| 495 | } |
| 496 | |
| 497 | add_action( 'wp_enqueue_scripts', 'mystickymenu_script' ); |
| 498 | ?> |