Created
May 24, 2018 00:47
-
-
Save erishel/04925b2d06ad2c5cb569dfc62bd70928 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*-----------------------------------------------------------------------------------*/ | |
/* The Events Calendar - Conditional Logic to Detect Various Event Related Views/Pages | |
/*-----------------------------------------------------------------------------------*/ | |
if ( tribe_is_month() && ! is_tax() ) { // Month View Page | |
echo 'were on the month view page'; | |
} elseif ( tribe_is_month() && is_tax() ) { // Month View Category Page | |
echo 'were on the month view category page'; | |
} elseif ( tribe_is_past() || tribe_is_upcoming() && ! is_tax() ) { // List View Page | |
echo 'were on the list view page'; | |
} elseif ( tribe_is_past() || tribe_is_upcoming() && is_tax() ) { // List View Category Page | |
echo 'were on an list view category page'; | |
} elseif ( tribe_is_day() && ! is_tax() ) { // Day View Page | |
echo 'were on the day view page'; | |
} elseif ( tribe_is_day() && is_tax() ) { // Day View Category Page | |
echo 'were on a day view category page'; | |
} else { | |
} | |
//Get Main Views in Pro only if Core and Pro Active | |
if ( class_exists( 'Tribe__Events__Main' ) && class_exists( 'Tribe__Events__Pro__Main' ) ) { | |
if ( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() || tribe_is_map() || tribe_is_photo() || tribe_is_week() ) { | |
//All Event Views | |
} | |
//Get Main Views in Core if Core is Active and Pro is Not | |
} elseif ( class_exists( 'Tribe__Events__Main' ) && ! class_exists( 'Tribe__Events__Pro__Main' ) ) { | |
if ( tribe_is_month() || tribe_is_upcoming() || tribe_is_past() || tribe_is_day() ) { | |
//Core Event Views Only | |
} | |
} | |
//If Tribe Events View or Single Template | |
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' ) ) { | |
//Do something if it's a Tribe Events Page | |
} else { | |
//Do something else if it's not a Tribe Events page | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment