twentyeleven_layout_classes

Add Twenty Eleven layout classes to the array of body classes.

Description

twentyeleven_layout_classes( (array) $existing_classes ); 

Parameters (1)

0. $existing_classes (array)
An array of existing body classes.

Usage

  1. if ( !function_exists( 'twentyeleven_layout_classes' ) ) { 
  2. require_once '/inc/theme-options.php'; 
  3.  
  4. // An array of existing body classes. 
  5. $existing_classes = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = twentyeleven_layout_classes($existing_classes); 
  9.  

Defined (1)

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

/inc/theme-options.php  
  1. function twentyeleven_layout_classes( $existing_classes ) { 
  2. $current_layout = $options['theme_layout']; 
  3.  
  4. if ( in_array( $current_layout, array( 'content-sidebar', 'sidebar-content' ) ) ) 
  5. $classes = array( 'two-column' ); 
  6. else 
  7. $classes = array( 'one-column' ); 
  8.  
  9. if ( 'content-sidebar' == $current_layout ) 
  10. $classes[] = 'right-sidebar'; 
  11. elseif ( 'sidebar-content' == $current_layout ) 
  12. $classes[] = 'left-sidebar'; 
  13. else 
  14. $classes[] = $current_layout; 
  15.  
  16. /** 
  17. * Filter the Twenty Eleven layout body classes. 
  18. * @since Twenty Eleven 1.0 
  19. * @param array $classes An array of body classes. 
  20. * @param string $current_layout The current theme layout. 
  21. */ 
  22. $classes = apply_filters( 'twentyeleven_layout_classes', $classes, $current_layout ); 
  23.  
  24. return array_merge( $existing_classes, $classes );