WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I making a widgetized footer with three widgetized areas (footer1, footer2, footer3), The problem is that even if there's no widgets assigned to any widgetized footer area, the footer is still there with his black background! what I want is to remove the footer if there isn't any widget assigned.

share|improve this question
up vote 1 down vote accepted

I would use the is_active_sidebar() conditional:

if ( is_active_sidebar( 'footer' ) ) {
    <div id="sidebar-footer">
        <?php dynamic_sidebar( 'footer' ); ?>

That way, you can conditionally output the styled container itself.

share|improve this answer
Thanks, it works like a charm :) – Rahman Sharif Mar 2 '13 at 22:33

I tried this solution but it doesn't work at all!

 if( !dynamic_sidebar('footer1') || !dynamic_sidebar('footer2') || !dynamic_sidebar('footer3') ) {
 // Do nothing
} else {
 // Display the footer

Thanks to Chip Bennett His solution works fine, I used it like that:

<?php if( is_active_sidebar('footer1') || is_active_sidebar('footer2') ||    is_active_sidebar('footer3')) { 
<div class="footer">
<?php } ?>

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.