wc_get_product_cat_class

Get the classes for the product cat div.

Description

wc_get_product_cat_class( (string) $class = '', (null) $category = null ); 

Parameters (2)

0. $class — Optional. (string) => ''
One or more classes to add to the class list.
1. $category — Optional. (null) => null
Object Optional.

Usage

  1. if ( !function_exists( 'wc_get_product_cat_class' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-template-functions.php'; 
  3.  
  4. // One or more classes to add to the class list. 
  5. $class = ''; 
  6.  
  7. // object Optional. 
  8. $category = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wc_get_product_cat_class($class, $category); 
  12.  

Defined (1)

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

/includes/wc-template-functions.php  
  1. function wc_get_product_cat_class( $class = '', $category = null ) { 
  2. $classes = is_array( $class ) ? $class : array_map( 'trim', explode( ' ', $class ) ); 
  3. $classes[] = 'product-category'; 
  4. $classes[] = 'product'; 
  5. $classes[] = wc_get_loop_class(); 
  6. $classes = apply_filters( 'product_cat_class', $classes, $class, $category ); 
  7.  
  8. return array_unique( array_filter( $classes ) );