+ * for global variables, since it is being changed or updated from time to time,
+ * please refer to Related Resources for more information
+ * https://codex.wordpress.org/WPMU_Functions/restore_current_blog
+switch_to_blog(1); // Switch to another blog by ID#
+// Check if The Events Calendar plugin is active
+// $events = tribe_get_events(); assigns array to $events variable
+if(function_exists('tribe_get_events')) {
+ // Get all events from starting -1 hour before the present date and time to 90 days into the future
+ $events = tribe_get_events( array(
+ 'start_date' => date( 'Y-m-d H:i:s', strtotime( '-1 hour' ) ),
+ 'end_date' => date( 'Y-m-d H:i:s', strtotime( '+90 day' ) ),
+ * Exclude events by tax_query -- https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
+ * This requires the tribe events category slug for Pitzer Now otherwise the event will not display
+ 'taxonomy' => 'tribe_events_cat',
+ 'terms' => 'pitzer-now',
+ // Get all events from starting -360 days before the present date and and ending an hour ago
+ $past = tribe_get_events( array(
+ 'start_date' => date( 'Y-m-d H:i:s', strtotime( '-360 day' ) ),
+ 'end_date' => date( 'Y-m-d H:i:s', strtotime( '-1 hour' ) ),
+ * Exclude events by tax_query -- https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
+ * This requires the tribe events category slug for Pitzer Now otherwise the event will not display
+ 'taxonomy' => 'tribe_events_cat',
+ 'terms' => 'pitzer-now',
+ // Display message if calendar is active but there are no events
+ if ( empty( $events ) ) {
+ echo '<strong class="events">No Upcoming Events Available</strong>';
+ echo '<div class="calendar upcoming">';
+ echo '<strong class="events">Upcoming Events</strong>';
+ // Create Foundation block grid https://get.foundation/sites/docs/flex-grid.html#block-grids
+ echo '<div class="row small-up-1 medium-up-3 large-up-5">';
+ } foreach( $events as $event ) {
+ echo '<div class="column">';
+ // get link and echo it
+ echo '<a href="' . tribe_get_event_link( $event ) . '">';
+ // get and echo the title
+ echo '<h1 class="event-title">' . get_the_title( $event ) . '</h1>';
+ // get and echo calendar icon, weekday, month, date
+ echo '<p class="event-details"><span class="dashicons dashicons-calendar-alt"></span> ' . tribe_get_start_date( $event, true, 'l, F j') . '<br />';
+ // get and echo clock icon, start time
+ echo '<span class="dashicons dashicons-clock"></span> ' . tribe_get_start_date( $event, true, 'g:i a') . '<br />';
+ // if event has a location get the location and echo it alogn with the icon
+ // Commented out to disable during covid-19
+/* if (tribe_get_venue( $event ) ) {
+ echo '<span class="dashicons dashicons-location-alt"></span> ' . tribe_get_venue( $event );
+ // close paragraph started above
+ // close link echoed above
+// Events calendar plugin not active
+ echo '<strong class="events">The Events Calendar plugin is not active</strong>';
+if(function_exists('tribe_get_events')) {
+ // Display message if calendar is active but there are no events
+ if ( empty( $past ) ) {
+ // No Past Events on the calendar
+ // loop through each event on the calendar
+ echo '<div class="calendar past">';
+ echo '<strong class="events">Past Events</strong>';
+ // Create Foundation block grid https://get.foundation/sites/docs/flex-grid.html#block-grids
+ echo '<div class="row small-up-1 medium-up-3 large-up-5" >';
+ } foreach( $past as $event ) {
+ echo '<div class="column">';
+ // get link and echo it
+ echo '<a href="' . tribe_get_event_link( $event ) . '">';
+ // get and echo the title
+ echo '<h1 class="event-title">' . get_the_title( $event ) . '</h1>';
+ // get and echo calendar icon, weekday, month, date
+ echo '<p class="event-details"><span class="dashicons dashicons-calendar-alt"></span> ' . tribe_get_start_date( $event, true, 'l, F j, Y') . '<br />';
+ // get and echo clock icon, start time
+ echo '<span class="dashicons dashicons-clock"></span> ' . tribe_get_start_date( $event, true, 'g:i a') . '<br />';
+ // if event has a location get the location and echo it alogn with the icon
+ // Commented out to disable during Covid-19
+ if (tribe_get_venue( $event ) ) {
+ echo '<span class="dashicons dashicons-location-alt"></span> ' . tribe_get_venue( $event );
+ // close paragraph started above
+ // close link echoed above
+// Events calendar plugin not active
+restore_current_blog(); // Switch back to current blog