Add Modern Tribe Event Categories as CSS classes in Event Posts
Event Categories are not added as CSS classes to individual Event Posts in the Modern Tribes Event Plugin for WordPress, however you can use the body_class filter to add them in.
add_filter( 'body_class', 'cp_event_taxonomy_in_body_class' ); // Ref - https://theeventscalendar.com/support/forums/topic/add-category-name-as-body_class/ // Add event categories terms to body class of event posts function cp_event_taxonomy_in_body_class( $classes ){ global $wp_query; $event_id = $wp_query->get_queried_object_id(); if ( ! tribe_is_event( $event_id ) || ! is_singular( 'tribe_events' ) ) return $classes; $event_cats = tribe_get_event_cat_slugs( $event_id ); if ( ! is_array( $event_cats ) || empty( $event_cats ) ) return $classes; foreach ( $event_cats as $key => $slug ) { $classes[] = sprintf( 'tribe-events-cat-%s', sanitize_html_class( $slug ) ); } return $classes; }
Add in your functions.php you may want a different prefix, if so change ‘tribe-events-cat-‘