• Hello,

    I am using Widget Logic plugin to show/hide widgets according to my site pages.

    I want to create logic like If there is no widget than there is no widget wrapper in content.

    Example:

    $the_sidebars = wp_get_sidebars_widgets();
    $featured     = count( $the_sidebars['featured-widget-area'] );
    $featured2    = count( $the_sidebars['featured2-widget-area'] );
    
    if( $featured>0 && $featured2>0 ){
    echo '<div id="featured-widget-wrapper">';
    dynamic_sidebar( 'featured-widget-area' );
    dynamic_sidebar( 'featured2-widget-area' );
    echo '</div>';
    }

    The problem is that the $featured variable is always with all widgets that are currently set, but I need only widgets that are available for current post/page. (I am disabling widgets with Widget Logic plugin.)

    I think I need to check output of a sidebar but I don’t know the function. the dynamic_sidebar() always calls and print widgets. So is there any function which works same as dynamic_sidebar() except call and print the widgets?

    Thanks
    Bimal

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘dynamic_sidebar() function without call’ is closed to new replies.