Created
September 2, 2016 23:07
-
-
Save JayWood/fb81113a3e409c90bddf22a43c29ab2b to your computer and use it in GitHub Desktop.
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
function add_custom_classes( $classes, $class, $post_id ) { | |
if ( 'product' == get_post_type( $post_id ) ) { | |
$classes[] = "sm-pid-" . $post_id; | |
// Post Class on Single Product | |
if ( is_singular( 'product' ) ) { | |
$classes[] = "sm-product-view"; | |
// Post Clas Product Archives Listing | |
} else { | |
$classes[] = "sm-product-list" | |
} | |
} | |
return $classes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also needs add_filter( 'post_class', 'fb_1398591523488596', 10, 3 ); in the end