The Events Calendar: To remove the All Events link from single-event.php and return to upcoming or archived events pages
<?php
$start = tribe_get_start_date( null, false, 'Ymd' );
$end = tribe_get_end_date( null, false, 'Ymd' );
if ($end > $start) {
$event_date = $end;
} else {
$event_date = $start;
}
$now = date_i18n( 'Ymd' );
echo '<p class="tribe-events-back">';
// If its start or end date (whichever is later) is in the past, link to event archive
if ( $now > $event_date ) {
echo '<a href="'.get_page_link(1568).'">« Back to Archived Events</a>';
} else { // otherwise, link to upcoming events
echo '<a href="'.get_page_link(2157).'">« Back to Upcoming Events</a>';
}
echo '</p>';
?>