Advertisement
alchymyth

added to functions.php 2011 child 4 widgets

Nov 20th, 2012
474
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. /**
  2.  * Count the number of footer sidebars to enable dynamic classes for the footer
  3.  */
  4. function twentyelevenchild_footer_sidebar_class() {
  5.     $count = 0;
  6.  
  7.     if ( is_active_sidebar( 'sidebar-3' ) )
  8.         $count++;
  9.  
  10.     if ( is_active_sidebar( 'sidebar-4' ) )
  11.         $count++;
  12.  
  13.     if ( is_active_sidebar( 'sidebar-5' ) )
  14.         $count++;
  15.  
  16.     if ( is_active_sidebar( 'sidebar-6' ) ) //the fourth new one//
  17.         $count++;
  18.  
  19.     $class = '';
  20.  
  21.     switch ( $count ) {
  22.         case '1':
  23.             $class = 'one';
  24.             break;
  25.         case '2':
  26.             $class = 'two';
  27.             break;
  28.         case '3':
  29.             $class = 'three';
  30.             break;
  31.         case '4':
  32.             $class = 'four';
  33.             break;
  34.     }
  35.  
  36.     if ( $class )
  37.         echo 'class="' . $class . '"';
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement