Restore default settings

Sidebars have an special option stored in database where they have all the information about each widget that is active on each sidebar. Adding this PHP code to the sidebar.php for your wordpress theme will let you check if a sidebar widget is active if not display something else.

 

 

<?php if ( function_exists('is_sidebar_active') && is_sidebar_active('sidebar') ) { ?>
<div id="sidebar">
<ul>
<?php dynamic_sidebar('sidebar'); ?>
</ul>
</div>
<?php }else{  ?>
..... no active widgets .....
<?php } ?>

Leave a comment