I was trying to do some specific template changes based on a category with Events Calendar Pro events. With single events, I could pretty easily use has_term like I’d do with a regular WP post.
has_term('no-registration', 'tribe_events_cat',get_queried_object_id());
For some reason this wouldn’t work with recurring events. I’m still not sure why. I didn’t go into the database deeply enough to figure it out because I really just needed to get a solution.
This seemed to work for me.
$terms = get_the_terms($post->ID, 'tribe_events_cat');//get the ECP terms for single or repeat event
function dlinq_event_no_registration($terms, $cat_slug){
foreach ($terms as $key => $term) {
if($term->slug === $cat_slug)//is it the slug we're looking for?
return TRUE;
}
}
//use it like this
if(dlinq_event_no_registration($terms, 'no-registration')){
echo "This event is private.";
}