I need to know how to check if the user is looking at an event or the list of events from the plugin The Events Calendar on my custom theme's page.php.
One solution I thought of was to grab the url. mysite.com/events shows the list of events, and mysite.com/event/theevent shows a specific event. I thought about grabbing the permalink using get_the_permalink()
/ get_permalink()
and checking if it contains event/events, but that doesn't seem to be returning anything for me while on an events page.
Or if I could set the category (the actual wordpress category, not the calendar category) to something like "events" I could use has_category('events'), but I don't know how to do that..
Any suggestions?
Edit:
I went snooping around in The Event Calendar's php files and found tribe_is_event()
and I'm able to determine if the page is an event, but only after the_content()
has been called. I need to know before that happens.