Skip to content

Instantly share code, notes, and snippets.

Created November 29, 2017 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/50c8dc925e0ee0958a5129c1056c0879 to your computer and use it in GitHub Desktop.
Save anonymous/50c8dc925e0ee0958a5129c1056c0879 to your computer and use it in GitHub Desktop.
/**
*Your code goes below
*/
/**
* [construction_base_pro_child_custom_body_classes description]
* @return array body_classes
*/
function construction_base_pro_child_custom_body_classes( $classes ){
if( is_single() ) {
$id = get_queried_object_id();
$terms = get_the_category( $id );
if( ! empty( $terms ) ) :
foreach( $terms as $key=>$term ) {
$classes[] = 'category-'.$term->slug;
}
endif;
return $classes;
}
}
add_action('body_class','construction_base_pro_child_custom_body_classes');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment