Skip to content

Instantly share code, notes, and snippets.

@JayWood
Created September 2, 2016 23:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayWood/fb81113a3e409c90bddf22a43c29ab2b to your computer and use it in GitHub Desktop.
Save JayWood/fb81113a3e409c90bddf22a43c29ab2b to your computer and use it in GitHub Desktop.
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;
}
@urbanoantunes
Copy link

Also needs add_filter( 'post_class', 'fb_1398591523488596', 10, 3 ); in the end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment