WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Query Multiple Taxonomies] Writing Multiple Taxonomies in Body Class?

[Plugin: Query Multiple Taxonomies] Writing Multiple Taxonomies in Body Class?

  • Is it possible to list multiple taxonomies, both the keys and the values, in the body tag class? Something like, for http://www.my-site.com/?genre=jazz&artist=bb-king :

    <body class="... tax_genre_jazz tax_artist_bb-king">

    I’ve tried the following code, but it ONLY works when there is a single taxonomy and it only show the key but not the value:

    add_filter('body_class','mysite_body_class');
    function mysite_body_class( $classes ) {
    	if( is_tax() ) {
    		global $taxonomy;
    		if( !in_array( $taxonomy, $classes ) )
    			$classes[] = "taxonomy " . "taxonomy-".$taxonomy;
    		}
    	return $classes;
    }

    Thanks a million for your help!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Query Multiple Taxonomies] Writing Multiple Taxonomies in Body Class?’ is closed to new replies.