Skip to content

Instantly share code, notes, and snippets.

@skyshab
Created April 16, 2019 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skyshab/25e58ee9b16b8f128f1efcd3f3c22dec to your computer and use it in GitHub Desktop.
Save skyshab/25e58ee9b16b8f128f1efcd3f3c22dec to your computer and use it in GitHub Desktop.
Add body class to events with a particular category
<?php // <== dont copy this line if your functions.php file already has the php opening tags
add_filter('body_class','my_add_custom_body_class');
function my_add_custom_body_class($classes) {
if( is_singular('tribe_events') && has_term( 'freeevents', 'tribe_events_cat' ) ) {
$classes[] = 'is-free-event';
}
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment