Modern Tribe Events Calendar Conditional Tag for Detecting all Calendar Pages
I like Modern Tribe’s Events calendar. It just works, and doesn’t take much setup yet seems to always just fit with the theme’s I build.
A bit costly (for the Pro version anyway), but that’s a good thing, because it typically means the developers are getting something back for their efforts, which leads to continued support and development. Like a dream Superbowl where the 1978 Steelers face the 2005 Steelers, playing into overtime and resulting in a final tie. That is, everyone wins.
Anyway, you’re not here for a big introduction. I just wanted a function that could say “if I’m on a page that has anything to do with the Events Calendar, do something.” I couldn’t find an existing function in their documentation, so I created one.
function is_tribe_calendar() { // detect if we're on an Events Calendar page
if (tribe_is_event() || tribe_is_event_category() || tribe_is_in_main_loop() || tribe_is_view() || 'tribe_events' == get_post_type() || is_singular( 'tribe_events' ))
return true;
else return false;
}
Enjoy.