- This topic has 3 replies, 2 voices, and was last updated 13 years, 3 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘Generic’ is closed to new topics and replies.
Events Made Easy › Forums › Generic › Checking category events
Hi,
I want to check a category to see if there are any future events and then show different blocks of HTML depending on the result. I can get my page template listing live events as I want but how do I show something instead of “No events”?
Thanks
I think you’re better off using the eme functions directly then, in your case eme_get_events will give you the results needed.
I’ll add an API function to give the count of number of events for a category:
eme_count_future_events($category_id)
eme_count_past_events($category_id)
Thanks but I don’t want it to say “No events” if there aren’t any, I want the template to show something different without editing the core functions + the theme breaking when any updates to the plugin are released.
What do I need to check against in an IF ELSE statement to see if events are being returned or not and then echo my message?
eme_get_events returns an array of events matching the criteria (given in arguments to the function), you can check the number of entries returned. That’s why I said what I said in my post above.