Bug? – product post class filter doesn't work
-
Don’t know if this is a bug or anything else but for some reason I can’t get the product post class filter not to work.
function shmoo_wc_product_post_class( $classes, $class = '', $post_id = '' ) { if ( ! $post_id || 'product' !== get_post_type( $post_id ) ) { return $classes; } $product = wc_get_product( $post_id ); if ( $product ) { if ( $product->is_on_sale() ) { $classes[] = 'sale'; } if ( $product->is_featured() ) { $classes[] = 'featured'; } } if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { unset( $classes[ $key ] ); } return $classes; } add_filter( 'post_class', 'shmoo_wc_product_post_class', 22, 4 );When I add this it keeps showing the category, tags and all other class names in the products list.
This is on a MultiSite install, I believe it has worked before on a single install like this.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Bug? – product post class filter doesn't work’ is closed to new replies.