Tribe Events Calendar – Conditional Wrappers

Putting this here so that I don’t have to keep Googling and bookmarking them.

Enjoy! 🙂

<?php
/*-----------------------------------------------------------------------------------*/
/* 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_week() && !is_tax() ) { // Week View Page
    echo 'were the week view page';
} elseif( tribe_is_week() && is_tax() ) { // Week View Category Page
    echo 'were the week 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';
} elseif( tribe_is_map() && !is_tax() ) { // Map View Page
    echo 'were on the map view page';
} elseif( tribe_is_map() && is_tax() ) { // Map View Category Page
    echo 'were on the map view category page';
} elseif( tribe_is_photo() && !is_tax() ) { // Photo View Page
    echo 'were on the photo view page';
} elseif( tribe_is_photo() && is_tax() ) { // Photo View Category Page
    echo 'were on the photo view category page';
} elseif( is_singular('tribe_events') ) { // Single Events
    echo 'were on a single event page';
} elseif( tribe_is_venue() ) { // Single Venues
    echo 'were on a single venue page';
} elseif( get_post_type() == 'tribe_organizer' && is_single() ) { // Single Organizers
    echo 'were on a single organizer page';
} else {
}

 

Sourced here.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.

%d bloggers like this: