Languages: English • active sidebar 日本語 (Add your language)
This Conditional Tag checks if a given sidebar is active (in use). This is a boolean function, meaning it returns either TRUE or FALSE.
Any sidebar that contains widgets will return TRUE, whereas any sidebar that does not contain any widgets will return FALSE.
<?php is_active_sidebar( $index ); ?>
Display different output depending on whether the sidebar is active or not.
<?php if ( is_active_sidebar( 'left-sidebar' ) ) { ?> <ul id="sidebar"> <?php dynamic_sidebar( 'left-sidebar' ); ?> </ul> <?php } ?>
Since: 2.8.0
is_active_sidebar() is located in wp-includes/widgets.php
.
Sidebars: is_active_sidebar(), is_dynamic_sidebar(), dynamic_sidebar(), register_sidebars(), register_sidebar(), unregister_sidebar(), wp_register_sidebar_widget(), wp_unregister_sidebar_widget(), wp_get_sidebars_widgets(), wp_set_sidebars_widgets()