• I added three widget areas in the footer of my Thesis theme. When they’re empty, I’d like them to just collapse instead of presenting me with three empty (but pretty) boxes.

    I read a 2-year-old solution posted in this forum but it doesn’t seem to work with 3.0. Has anyone come across — or have a solution for this?
    Thanks very much
    Bill

Viewing 4 replies - 1 through 4 (of 4 total)
  • check the code of sidebar-footer.php of the Twenty Ten theme.

    Thread Starter transformer617

    (@transformer617)

    Oh, this is very cool! ?? Thanks lots for the tip. I modified this piece of code found in the twentyten file sidebar-footer.php:

    if (   ! is_active_sidebar( 'first-footer-widget-area'  )
    		&& ! is_active_sidebar( 'second-footer-widget-area' )
    		&& ! is_active_sidebar( 'third-footer-widget-area'  )
    		&& ! is_active_sidebar( 'fourth-footer-widget-area' )
    	)
    		return;

    Worked like a charm. My next step in making this even more awesome would be if, for instance, only one or two widgets were present in a three widget block, the dimensions would adjust to fill the area. Any ideas about that? (Maybe I should post this question separately)

    Along the lines of this post, I’m trying to hide the left-hand column in header.php in a PHP conditional when the sidebars are not active. However, the following is returning false.

    <?php if (is_active_sidebar('sidebar1') && is_active_sidebar('sidebar2')) { ?>
       <div id="left-col">
          <?php get_sidebar(); ?>
       </div>
       <div id="right-col">
    <?php } else { ?>
       <div id="right-col-wide">
    <?php } ?>

    Any thoughts on why this wouldn’t work?

    I figured out the problem. My function had an extra attribute for id that it didn’t recognize.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘collapse empty widget areas (WP3)?’ is closed to new replies.