Adds classes for custom taxonomies to body_class()
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
function fb_add_body_class( $class ) { | |
if ( ! is_tax() ) | |
return $class; | |
$tax = get_query_var( 'taxonomy' ); | |
$term = $tax . '-' . get_query_var( 'term' ); | |
$class = array_merge( $classes, array( 'taxonomy-archive', $tax, $term ) ); | |
return $class; | |
} | |
add_filter( 'body_class', 'fb_add_body_class' ); // or post_class as hook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment