Support » Plugin: Widget Options » Body class if visible

  • Resolved pagetopixel

    (@pagetopixel)


    Hello, Great plugin!

    I am trying to add a custom body class if the widget is active on a certain page. In my case it is a slider.

    add_filter('body_class', function (array $classes) {
        if ( is_active_sidebar( 'slider' ) ) {
    		$classes[] = 'slider-active';
    	}
      return $classes;
    });
    

    This filter adds the class without issue but it is showing on all pages even though my widget is only set to display on the Home/Front. Is there a way I can set it to only show on the pages it is active on by adding a variable to check if the widget option is set to visible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author phpbits

    (@phpbits)

    Hi,

    Thank you very much for choosing Widget Options and I’m glad that you are loving the plugin features. Regarding your concern, the is_active_sidebar() fix is currently available on the development version and will be added on the next release. Please replace your files with the plugin files here : https://github.com/phpbits/widget-options/tree/develop and let me know how it goes. Thanks!

    Cheers,
    Jeffrey

    pagetopixel

    (@pagetopixel)

    That worked great! Thanks

    Plugin Author phpbits

    (@phpbits)

    @pagetopixel sounds perfect 🙂 I hope you are loving the plugin features. Thanks!

    Cheers,
    Jeffrey

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.