twentyeleven_footer_sidebar_class

Count the number of footer sidebars to enable dynamic classes for the footer.

Description

twentyeleven_footer_sidebar_class(); 

Usage

  1. if ( !function_exists( 'twentyeleven_footer_sidebar_class' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = twentyeleven_footer_sidebar_class(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function twentyeleven_footer_sidebar_class() { 
  2. $count = 0; 
  3.  
  4. if ( is_active_sidebar( 'sidebar-3' ) ) 
  5. $count++; 
  6.  
  7. if ( is_active_sidebar( 'sidebar-4' ) ) 
  8. $count++; 
  9.  
  10. if ( is_active_sidebar( 'sidebar-5' ) ) 
  11. $count++; 
  12.  
  13. $class = ''; 
  14.  
  15. switch ( $count ) { 
  16. case '1': 
  17. $class = 'one'; 
  18. break; 
  19. case '2': 
  20. $class = 'two'; 
  21. break; 
  22. case '3': 
  23. $class = 'three'; 
  24. break; 
  25.  
  26. if ( $class ) 
  27. echo 'class="' . $class . '"';