16
16
* @author Jory Hogeveen <[email protected] >
17
17
* @package Off_Canvas_Sidebars
18
18
* @since 0.1.0
19
- * @version 0.5.3
19
+ * @version 0.5.4
20
20
* @uses \OCS_Off_Canvas_Sidebars_Base Extends class
21
21
*/
22
22
final class OCS_Off_Canvas_Sidebars_Frontend extends OCS_Off_Canvas_Sidebars_Base
@@ -74,8 +74,12 @@ private function default_actions() {
74
74
$ after_hook = trim ( $ this ->get_settings ( 'website_after_hook ' ) );
75
75
76
76
if ( 'genesis ' === get_template () ) {
77
- $ before_hook = 'genesis_before ' ;
78
- $ after_hook = 'genesis_after ' ;
77
+ if ( empty ( $ before_hook ) ) {
78
+ $ before_hook = 'genesis_before ' ;
79
+ }
80
+ if ( empty ( $ after_hook ) ) {
81
+ $ after_hook = 'genesis_after ' ;
82
+ }
79
83
} else {
80
84
if ( empty ( $ before_hook ) ) {
81
85
$ before_hook = 'website_before ' ;
@@ -248,7 +252,7 @@ public function do_sidebar( $sidebar_id ) {
248
252
/**
249
253
* Filter nav menu args.
250
254
*
251
- * Please note that the theme_location property will be overwritten!
255
+ * Please note that the ` theme_location` and `echo` properties will be overwritten!
252
256
*
253
257
* @since 0.3.0
254
258
*
@@ -259,9 +263,9 @@ public function do_sidebar( $sidebar_id ) {
259
263
* @param string $sidebar_id The ID of this sidebar as configured in: Appearance > Off-Canvas Sidebars > Sidebars.
260
264
* @param array $sidebar_data The sidebar settings.
261
265
*/
262
- apply_filters ( 'ocs_wp_nav_menu_args ' , $ args , $ sidebar_id , $ sidebar_data );
266
+ $ args = apply_filters ( 'ocs_wp_nav_menu_args ' , $ args , $ sidebar_id , $ sidebar_data );
263
267
264
- // Force the set theme location.
268
+ // Force the theme location.
265
269
$ args ['theme_location ' ] = 'off-canvas- ' . $ sidebar_id ;
266
270
// Force echo.
267
271
$ args ['echo ' ] = true ;
@@ -352,7 +356,7 @@ public function get_container_attributes() {
352
356
'id ' => $ this ->get_settings ( 'css_prefix ' ) . '-site ' ,
353
357
'canvas ' => 'container ' ,
354
358
'data-ocs-site_close ' => (bool ) $ this ->get_settings ( 'site_close ' ),
355
- 'data-ocs-disable_over ' => (int ) $ this ->get_settings ( 'disable_over ' ),
359
+ 'data-ocs-disable_over ' => (int ) $ this ->get_settings ( 'disable_over ' ),
356
360
'data-ocs-hide_control_classes ' => (bool ) $ this ->get_settings ( 'hide_control_classes ' ),
357
361
'data-ocs-scroll_lock ' => (bool ) $ this ->get_settings ( 'scroll_lock ' ),
358
362
);
@@ -379,8 +383,10 @@ public function get_sidebar_attributes( $sidebar_id, $data ) {
379
383
$ atts ['class ' ] = array ();
380
384
$ atts ['class ' ][] = $ prefix . '-slidebar ' ;
381
385
$ atts ['class ' ][] = $ prefix . '- ' . $ sidebar_id ;
382
- $ atts ['class ' ][] = 'ocs-slidebar ' ;
383
- $ atts ['class ' ][] = 'ocs- ' . $ sidebar_id ;
386
+ if ( 'ocs ' !== $ prefix ) {
387
+ $ atts ['class ' ][] = 'ocs-slidebar ' ;
388
+ $ atts ['class ' ][] = 'ocs- ' . $ sidebar_id ;
389
+ }
384
390
$ atts ['class ' ][] = 'ocs-size- ' . $ data ['size ' ];
385
391
$ atts ['class ' ][] = 'ocs-location- ' . $ data ['location ' ];
386
392
$ atts ['class ' ][] = 'ocs-style- ' . $ data ['style ' ];
@@ -443,7 +449,7 @@ public function do_control_trigger( $sidebar_id, $args = array() ) {
443
449
public function add_styles_scripts () {
444
450
445
451
// @todo Validate and use minified files
446
- $ suffix = '' ;//defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
452
+ $ suffix = '' ;//defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
447
453
$ version = ( defined ( 'SCRIPT_DEBUG ' ) && SCRIPT_DEBUG ) ? time () : OCS_PLUGIN_VERSION ;
448
454
449
455
// FastClick library https://github.com/ftlabs/fastclick
@@ -467,17 +473,21 @@ public function add_styles_scripts() {
467
473
$ sidebars [ $ sidebar_id ] = $ sidebar_data ;
468
474
}
469
475
}
470
- wp_localize_script ( 'off-canvas-sidebars ' , 'ocsOffCanvasSidebars ' , array (
471
- 'site_close ' => (bool ) $ this ->get_settings ( 'site_close ' ),
472
- 'link_close ' => (bool ) $ this ->get_settings ( 'link_close ' ),
473
- 'disable_over ' => (int ) $ this ->get_settings ( 'disable_over ' ),
474
- 'hide_control_classes ' => (bool ) $ this ->get_settings ( 'hide_control_classes ' ),
475
- 'scroll_lock ' => (bool ) $ this ->get_settings ( 'scroll_lock ' ),
476
- 'legacy_css ' => (bool ) ( 'legacy-css ' === $ this ->get_settings ( 'compatibility_position_fixed ' ) ),
477
- 'css_prefix ' => $ this ->get_settings ( 'css_prefix ' ),
478
- 'sidebars ' => $ sidebars ,
479
- '_debug ' => (bool ) ( defined ( 'WP_DEBUG ' ) && WP_DEBUG ),
480
- ) );
476
+ wp_localize_script (
477
+ 'off-canvas-sidebars ' ,
478
+ 'ocsOffCanvasSidebars ' ,
479
+ array (
480
+ 'site_close ' => (bool ) $ this ->get_settings ( 'site_close ' ),
481
+ 'link_close ' => (bool ) $ this ->get_settings ( 'link_close ' ),
482
+ 'disable_over ' => (int ) $ this ->get_settings ( 'disable_over ' ),
483
+ 'hide_control_classes ' => (bool ) $ this ->get_settings ( 'hide_control_classes ' ),
484
+ 'scroll_lock ' => (bool ) $ this ->get_settings ( 'scroll_lock ' ),
485
+ 'legacy_css ' => (bool ) ( 'legacy-css ' === $ this ->get_settings ( 'compatibility_position_fixed ' ) ),
486
+ 'css_prefix ' => $ this ->get_settings ( 'css_prefix ' ),
487
+ 'sidebars ' => $ sidebars ,
488
+ '_debug ' => (bool ) ( defined ( 'WP_DEBUG ' ) && WP_DEBUG ),
489
+ )
490
+ );
481
491
}
482
492
483
493
/**
0 commit comments