Support

Home Forums Event Espresso Premium Conditional statement within event grid loop – result depends on category

Conditional statement within event grid loop – result depends on category

Posted: February 1, 2019 at 4:48 pm


Praxis

February 1, 2019 at 4:48 pm

Hi,
Can you guys help me write a conditional statement on the espresso grid template? For each event listed, i’d like to show different time info depending on the parent event category.
I believe it’s something like,

<?php if(is_espresso_event_category(x)) {
espresso_event_date_range();
}
elseif (is_espresso_event_category(y)) {
echo '<div>On-Demand, no date range</div>';
}
else echo'<div>Have a nice day</div>' ?>

But of course this doesn’t work.
Here’s the page in question: https://dev-praxis-cet.pantheonsite.io/online/

I’m on EE 4.9.77.p


Praxis

February 1, 2019 at 5:21 pm

should i be using some version of this?
https://gist.github.com/Pebblo/b9e0ced7289bd6331695


Praxis

February 4, 2019 at 6:49 pm

ok, i found the advice here: https://eventespresso.com/topic/check-if-event-is-in-sepcific-category/
and it worked once i put the statement inside the while loop.

The support post ‘Conditional statement within event grid loop – result depends on 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