Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save celticwebdesign/60b594b5b60b691fd78f3ede109cea1d to your computer and use it in GitHub Desktop.
Save celticwebdesign/60b594b5b60b691fd78f3ede109cea1d to your computer and use it in GitHub Desktop.
<body
<?php
if( is_singular('things_to_do') ) {
// allows us to add taxonomy term to body class
$things_to_do_queried_object = get_queried_object();
$terms = get_the_terms( $things_to_do_queried_object->ID, 'things_to_do_type' );
if ( $terms && ! is_wp_error( $terms ) ) :
$draught_links = array();
foreach ( $terms as $term ) {
$draught_links[] = $term->name;
}
$on_draught = join( ", ", $draught_links );
endif;
body_class($term->slug);
} else {
body_class();
}
?>
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment