Ejemplo n.º 1
0
 /**
  * Set up the notices for this template
  *
  * @return void
  * @since 3.0
  **/
 public function set_notices()
 {
     parent::set_notices();
     // Check if event has passed
     $gmt_offset = get_option('gmt_offset') >= '0' ? ' +' . get_option('gmt_offset') : " " . get_option('gmt_offset');
     $gmt_offset = str_replace(array('.25', '.5', '.75'), array(':15', ':30', ':45'), $gmt_offset);
     if (!tribe_is_showing_all() && strtotime(tribe_get_end_date(get_the_ID(), false, 'Y-m-d G:i') . $gmt_offset) <= time()) {
         TribeEvents::setNotice('event-past', __('This event has passed.', 'tribe-events-calendar'));
     }
 }
Ejemplo n.º 2
0
 /**
  * Set up the notices for this template
  *
  * @return void
  **/
 public function set_notices()
 {
     global $wp_query;
     $tribe = TribeEvents::instance();
     $geographic_term = '';
     $search_term = '';
     $tax_term = '';
     // No need to set notices unless we didn't find anything
     if (have_posts()) {
         return;
     }
     // Do we have a keyword or place name search?
     if (!empty($wp_query->query_vars['s'])) {
         $search_term = $wp_query->query_vars['s'];
     } elseif (!empty($_REQUEST['tribe-bar-search'])) {
         $search_term = $_REQUEST['tribe-bar-search'];
     } elseif (!empty($_REQUEST['tribe-bar-geoloc'])) {
         $geographic_term = $_REQUEST['tribe-bar-geoloc'];
     }
     if (is_tax($tribe->get_event_taxonomy())) {
         $tax_term = get_term_by('slug', get_query_var('term'), $tribe->get_event_taxonomy());
         $tax_term = $tax_term->name;
     }
     // No events found on this day
     if (empty($search_term) && empty($geographic_term) && !empty($tax_term)) {
         TribeEvents::setNotice('events-not-found', sprintf(__('No matching events listed under %s scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), $tax_term, date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate')))));
     } elseif (empty($search_term) && empty($geographic_term)) {
         TribeEvents::setNotice('events-not-found', sprintf(__('No events scheduled for <strong>%s</strong>. Please try another day.', 'tribe-events-calendar'), date_i18n(tribe_get_date_format(true), strtotime(get_query_var('eventDate')))));
     } else {
         parent::set_notices();
     }
 }