Created
September 2, 2016 16:48
-
-
Save JayWood/e3c5b49b534e66bf3c247052f16bca80 to your computer and use it in GitHub Desktop.
Woocommerce Product Singular vs Archive classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function fb_1398591523488596( $classes, $class, $post_id ) { | |
if ( 'product' == get_post_type( $post_id ) ) { | |
if ( is_singular( 'product' ) ) { | |
$classes[] = "post-class-when-viewing-single-product"; | |
} else { | |
$classes[] = "non-single-product-page-class" | |
} | |
} | |
return $classes; | |
} | |
add_filter( 'post_class', 'fb_1398591523488596', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment