Ejemplo n.º 1
0
 /**
  * Set the notices used on month view
  *
  * @param array $args Set of $wp_query params for the month view, if none passed then will default to $wp_query
  */
 public function __construct($args = null)
 {
     if ($args === null) {
         global $wp_query;
         $args = $wp_query->query;
         if (!empty($wp_query->query_vars['meta_query'])) {
             $args['meta_query'] = $wp_query->query_vars['meta_query'];
         }
     }
     $this->use_cache = tribe_get_option('enable_month_view_cache', false);
     // Cache the result of month/content.php
     if ($this->use_cache) {
         $cache_expiration = apply_filters('tribe_events_month_view_transient_expiration', HOUR_IN_SECONDS);
         $this->html_cache = new Tribe__Events__Template_Part_Cache('month/content.php', serialize($args), $cache_expiration, 'save_post');
     }
     self::$args = $args;
     self::$posts_per_page_limit = apply_filters('tribe_events_month_day_limit', tribe_get_option('monthEventAmount', '3'));
     // don't enqueue scripts and js when we're not constructing month view,
     // they'll have to be enqueued separately
     if (!tribe_is_month()) {
         $this->asset_packages = array();
     }
     parent::__construct();
 }
Ejemplo n.º 2
0
 /**
  * Set the notices used on month view.
  *
  * @param array $args Set of $wp_query params for the month view, if none passed then will default to $wp_query.
  */
 public function __construct($args = null)
 {
     if ($args === null) {
         global $wp_query;
         $args = $wp_query->query;
         if (!empty($wp_query->query_vars['meta_query'])) {
             $args['meta_query'] = $wp_query->query_vars['meta_query'];
         }
     }
     $this->use_cache = tribe_get_option('enable_month_view_cache', false);
     // Cache the result of month/content.php
     if ($this->use_cache) {
         $cache_expiration = apply_filters('tribe_events_month_view_transient_expiration', HOUR_IN_SECONDS);
         $this->html_cache = new Tribe__Events__Template_Part_Cache('month/content.php', serialize($args), $cache_expiration, 'save_post');
     }
     $args = (array) $args;
     self::$args = (array) $args;
     $this->events_per_day = apply_filters('tribe_events_month_day_limit', tribe_get_option('monthEventAmount', '3'));
     $this->requested_date = $this->requested_date();
     $this->first_grid_date = $this->calculate_first_cell_date($this->requested_date);
     $this->final_grid_date = $this->calculate_final_cell_date($this->requested_date);
     // get all the ids for the events in this month, speeds up queries
     $this->events_in_month = tribe_get_events(array_merge($args, array('fields' => 'ids', 'start_date' => $this->first_grid_date, 'end_date' => $this->final_grid_date, 'posts_per_page' => -1)));
     // don't enqueue scripts and js when we're not constructing month view,
     // they'll have to be enqueued separately
     if (!tribe_is_month()) {
         $this->asset_packages = array();
     }
     parent::__construct();
 }