Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // add classes to body based on custom taxonomy portfolio_cats
- function wpex_port_tax_body_class( $classes ) {
- if('portfolio' == get_post_type() ) {
- global $post;
- $terms = get_the_terms( $post->ID, 'portfolio_cats' );
- if($terms) {
- foreach ($terms as $term) {
- $term_classes[] = 'portfolio-' . $term->slug;
- }
- $classes = array_merge( $classes, $term_classes );
- }
- }
- return $classes;
- }
- add_filter( 'body_class', 'wpex_port_tax_body_class' );
Advertisement
Add Comment
Please, Sign In to add comment