If you want to display a fallback sidebar, you can do the following. If you want to decide which widget gets displayed, then idk.
Create 2 sidebars. Example: sidebar
and fallback-sidebar
.
In your template you can use:
if(is_active_sidebar( 'sidebar' )){
dynamic_sidebar( 'sidebar' );
} else {
dynamic_sidebar( 'fallback-sidebar' );
}
If you just trying to determine if a particular sidebar is active find the id of the sidebar and use:
if(is_active_sidebar( $sidebarID )){
//do stuff here
}
This might work: (Sorry im not at a pc i can test it at)
if(is_active_sidebar( $sidebarID )){
the_widget('WP_Widget_Archives', $instance, $args);
}
//I believe this will attempt to display the WP_Widget_Archives widget, if the
//sidebar with the id of $sidebarID is inactive.