layers_get_center_column_class

The Layers layers get center column class function.

Description

layers_get_center_column_class( (string) $class = '' ); 

Parameters (1)

0. $class — Optional. (string) => ''
The class.

Usage

  1. if ( !function_exists( 'layers_get_center_column_class' ) ) { 
  2. require_once '/core/helpers/template.php'; 
  3.  
  4. // The class. 
  5. $class = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = layers_get_center_column_class($class); 
  9.  

Defined (1)

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

/core/helpers/template.php  
  1. function layers_get_center_column_class( $class = '' ) { 
  2.  
  3. $classes = array(); 
  4.  
  5. // This div will always have the .column class 
  6. $classes[] = 'column'; 
  7.  
  8. $left_sidebar_active = layers_can_show_sidebar( 'left-sidebar' ); 
  9. $right_sidebar_active = layers_can_show_sidebar( 'right-sidebar' ); 
  10.  
  11. // Set classes according to the sidebars 
  12. if( $left_sidebar_active && $right_sidebar_active ) { 
  13. $classes[] = 'span-6'; 
  14. } else if( $left_sidebar_active ) { 
  15. $classes[] = 'span-8'; 
  16. } else if( $right_sidebar_active ) { 
  17. $classes[] = 'span-8'; 
  18. } else { 
  19. $classes[] = 'span-12'; 
  20.  
  21. // If there is a left sidebar and no right sidebar, add the no-gutter class 
  22. if( $left_sidebar_active && !$right_sidebar_active ) { 
  23. $classes[] = 'no-gutter'; 
  24.  
  25. // Default to Header Left if there are no matches above 
  26. if( empty( $classes ) ) { 
  27. $classes[] = 'span-8'; 
  28.  
  29. // Apply any classes passed as parameter 
  30. if( '' != $class ) $classes[] = $class; 
  31.  
  32. $classes = array_map( 'esc_attr', $classes ); 
  33.  
  34. $classes = apply_filters( 'layers_center_column_class', $classes, $class ); 
  35.  
  36. return array_unique( $classes ); 
  37.