예제 #1
0
 /**
  * Get number of events per day
  *
  * @param int $date
  * @return array
  */
 private static function get_daily_counts($date)
 {
     global $wp_query;
     $count_args = self::$args;
     do_action('log', 'get_daily_counts $date', 'tribe-events-query', $date);
     $count_args['eventDisplay'] = 'month';
     $count_args['eventDate'] = date('Y-m', strtotime($date));
     $count_args['start_date'] = tribe_event_beginning_of_day($date);
     $count_args['end_date'] = tribe_event_end_of_day(date('Y-m-t', strtotime($date) + 1));
     $count_args['hide_upcoming_ids'] = self::$hide_upcoming_ids;
     $count_args['post_status'] = is_user_logged_in() ? array('publish', 'private') : 'publish';
     $count_args['tribeHideRecurrence'] = false;
     $result = TribeEventsQuery::getEventCounts($count_args);
     self::$event_daily_counts = $result['counts'];
     self::$event_daily_ids = $result['event_ids'];
     foreach (self::$event_daily_counts as $daily_count) {
         if ($daily_count > 0) {
             add_filter('tribe_events_month_has_events', '__return_true');
             break;
         }
     }
 }
예제 #2
0
파일: month.php 프로젝트: paarthd/gslvpa
 /**
  * Get number of events per day
  *
  * @param int $date
  * @return array
  * @since 3.0
  */
 private static function get_daily_counts($date)
 {
     global $wp_query;
     $count_args = self::$args;
     $count_args['eventDisplay'] = 'month';
     $count_args['eventDate'] = date('Y-m', $date);
     $count_args['start_date'] = date('Y-m-d', $date) . ' 00:00:00';
     $count_args['end_date'] = date('Y-m-t', $date) . ' 23:59:59';
     $count_args['hide_upcoming_ids'] = self::$hide_upcoming_ids;
     $count_args['post_status'] = is_user_logged_in() ? array('publish', 'private') : 'publish';
     $cache = new TribeEventsCache();
     $cache_key = 'daily_counts_' . serialize($count_args);
     $found = $cache->get($cache_key, 'save_post');
     if ($found && is_array($found)) {
         return $found;
     }
     $result = TribeEventsQuery::getEventCounts($count_args);
     $cache->set($cache_key, $result, self::$cache_expiration, 'save_post');
     return $result;
 }