Skip to content

Instantly share code, notes, and snippets.

@waynebcox
Last active August 9, 2016 12:38
Show Gist options
  • Save waynebcox/d66c70cbe15b04e9ebc6db2326f6a91d to your computer and use it in GitHub Desktop.
Save waynebcox/d66c70cbe15b04e9ebc6db2326f6a91d to your computer and use it in GitHub Desktop.
[ Genesis ] Add body class based on category slug
//* Add new body class based on post category
add_filter('body_class', 'wc_category_class_single');
function wc_category_class_single($classes){
global $post;
if(is_single()) {
$category = get_the_category($post->ID);
$slug = $category[0]->slug;
$classes[] = 'post-category-'.$slug;
}
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment