Last active
August 29, 2015 13:57
-
-
Save ckpicker/9555637 to your computer and use it in GitHub Desktop.
Events Calendar 3.4 // Add Category Slugs to body_class() when viewing Single Events
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
add_filter('body_class', 'event_category_body_classes'); | |
function event_category_body_classes($classes) { | |
if ( tribe_is_event() && is_single() ) { | |
//Query event categories | |
$event_categories = wp_get_post_terms( get_the_ID(), 'tribe_events_cat' ); | |
if( !empty( $event_categories ) ) { | |
foreach( $event_categories as $single_category ) { | |
$classes[] = 'tribe-events-cat-' . $single_category->slug; | |
} | |
} | |
} | |
return $classes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment