Created
November 29, 2017 06:53
-
-
Save anonymous/50c8dc925e0ee0958a5129c1056c0879 to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
*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