function tribe_next_week_link($text = '') { try { $url = tribe_get_next_week_permalink(); if (empty($text)) { $text = __('Next Week <span>»</span>', 'tribe-events-calendar-pro'); } $html = sprintf('<a %s href="%s" rel="next">%s</a>', tribe_events_the_nav_attributes('next', false), $url, $text); } catch (OverflowException $e) { $html = ''; } return $html; }
function tribe_next_week_link($text = '') { try { $date = date(TribeDateUtils::DBDATEFORMAT, strtotime(tribe_get_first_week_day() . ' +1 week')); if ($date >= tribe_events_latest_date(TribeDateUtils::DBDATEFORMAT)) { return ''; } $url = tribe_get_next_week_permalink(); if (empty($text)) { $text = __('Next Week <span>»</span>', 'tribe-events-calendar-pro'); } return sprintf('<a %s href="%s" rel="next">%s</a>', tribe_events_the_nav_attributes('next', false), $url, $text); } catch (OverflowException $e) { return ''; } }
/** * Build the next week link * * @param string $text the text to be linked * * @return string */ function tribe_events_week_next_link($text = '') { try { $date = date(Tribe__Events__Date_Utils::DBDATEFORMAT, strtotime(tribe_get_first_week_day() . ' +1 week')); if ($date >= tribe_events_latest_date(Tribe__Events__Date_Utils::DBDATEFORMAT)) { return ''; } $url = tribe_get_next_week_permalink(); if (empty($text)) { $text = __('Next Week <span>»</span>', 'tribe-events-calendar-pro'); } global $wp_query; $current_week = tribe_get_first_week_day($wp_query->get('start_date')); $attributes = sprintf(' data-week="%s" ', date('Y-m-d', strtotime($current_week . ' +7 days'))); return sprintf('<a %s href="%s" rel="next">%s</a>', $attributes, esc_url($url), $text); } catch (OverflowException $e) { return ''; } }
<h3 class="tribe-events-visuallyhidden"><?php _e('Week Navigation', 'tribe-events-calendar-pro'); ?> </h3> <ul class="tribe-events-sub-nav"> <li class="tribe-events-nav-previous"> <a <?php tribe_events_the_nav_attributes('prev'); ?> href="<?php echo tribe_get_last_week_permalink(); ?> " rel="prev">« <?php _e('Previous Week', 'tribe-events-calendar-pro'); ?> </a> </li><!-- .tribe-events-nav-previous --> <li class="tribe-events-nav-next"> <a <?php tribe_events_the_nav_attributes('next'); ?> href="<?php echo tribe_get_next_week_permalink(); ?> " rel="next"><?php _e('Next Week', 'tribe-events-calendar-pro'); ?> »</a> </li><!-- .tribe-events-nav-next --> </ul><!-- .tribe-events-sub-nav -->