layers_woocommerce_center_column_class

The Layers layers woocommerce center column class function.

Description

layers_woocommerce_center_column_class( $classes ); 

Parameters (1)

0. $classes
The classes.

Usage

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

Defined (1)

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

/core/helpers/woocommerce.php  
  1. function layers_woocommerce_center_column_class( $classes ) { 
  2.  
  3. if( !function_exists( 'is_shop' ) ) { 
  4. return $classes; 
  5. } else { 
  6. if( !is_shop() && !is_post_type_archive( 'product' ) && !is_singular( 'product' ) && !is_tax( 'product_cat' ) && !is_tax( 'product_tag' ) ) { 
  7. return $classes; 
  8.  
  9. $left_sidebar_active = layers_can_show_sidebar( 'left-woocommerce-sidebar' ); 
  10. $right_sidebar_active = layers_can_show_sidebar( 'right-woocommerce-sidebar' ); 
  11.  
  12. // Unset default classes 
  13. foreach( $classes as $key => $this_class ) { 
  14. if( 'span-6' == $this_class ) { 
  15. unset( $classes[ $key ] ); 
  16. } else if( 'span-9' == $this_class ) { 
  17. unset( $classes[ $key ] ); 
  18. } else if( 'span-12' == $this_class ) { 
  19. unset( $classes[ $key ] ); 
  20. } else if( 'span-8' == $this_class ) { 
  21. unset( $classes[ $key ] ); 
  22. } else if( 'no-gutter' == $this_class ) { 
  23. unset( $classes[ $key ] ); 
  24.  
  25. // Set post classes 
  26. if( $left_sidebar_active && $right_sidebar_active ) { 
  27. $classes[] = 'span-6'; 
  28. } else if( $left_sidebar_active ) { 
  29. $classes[] = 'span-9'; 
  30. } else if( $right_sidebar_active ) { 
  31. $classes[] = 'span-9'; 
  32. } else { 
  33. $classes[] = 'span-12'; 
  34.  
  35. // If there is a left sidebar and no right sidebar, add the no-gutter class 
  36. if( $left_sidebar_active && !$right_sidebar_active ) { 
  37. $classes[] = 'no-gutter'; 
  38.  
  39. return $classes; 
  40.