So I know that this is going to come out in 3.1 but for anyone who needs this currently this might be helpful. I was building a site that had a custom taxonomy of say “portfolio types” and I made an archive for that page (taxonomy-portfolio-types.php). You’d think that the body class would automatically be but alas it was just “archive”. Not very useful if you want to style some part of the header or footer slightly differently than your other archive pages without writing conditionals into them. Well here’s how to add “portfolio-types” or your own taxonomy into your body class.
Note: Add this code into your functions.php
-
add_filter( 'body_class', 'add_tax_bodyclass' );
-
function add_tax_bodyclass( $classes ){
-
if( is_archive() && is_tax() == 'portfolio-types')
-
{
-
$classes[] = 'portfolio-types';
-
}
-
return $classes;
-
}


