Support

Home Forums Event Espresso Premium Check if event is in sepcific category

Check if event is in sepcific category

Posted: January 14, 2015 at 10:44 am


evan fort

January 14, 2015 at 10:44 am

Hi there, how would I create a conditional tag to determine if my queried event is in a specific category? What’s the

<?php if (in_category('cloud')) {
	  // do something
	}
	else {
	  // do something
	}
				
?>	

EE4


Josh

  • Support Staff

January 14, 2015 at 12:41 pm

Hi Evan,

You can use has_term() for custom taxonomies like event categories.

<?php 
if ( has_term( 'cloud', 'espresso_event_categories' ) ) {
	  // do something
	}
	else {
	  // do something
	}
				
?>


evan fort

January 14, 2015 at 1:11 pm

perfect, thanks!


Josh

  • Support Staff

January 14, 2015 at 2:57 pm

You’re welcome.

The support post ‘Check if event is in sepcific category’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso