/** * EE_Event_List_Query Constructor * * sets up a WordPress query * * @param array $args * @return \EE_Event_List_Query */ function __construct($args = array()) { // printr( $args, '$args <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); // incoming args could be a mix of WP query args + EE shortcode args foreach ($args as $key => $value) { $property = '_' . $key; // if the arg is a property of this class, then it's an EE shortcode arg if (EEH_Class_Tools::has_property($this, $property)) { // set the property value $this->{$property} = $value; // then remove it from the array of args that will later be passed to WP_Query() unset($args[$key]); } } // setup the events list query EE_Registry::instance()->load_helper('Event_Query'); EEH_Event_Query::filter_query_parts(); EEH_Event_Query::set_query_params($this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort); // first off, let's remove any filters from previous queries remove_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title')); remove_all_filters('FHEE__content_espresso_events__event_class'); // Event List Title ? add_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title'), 10, 1); // add the css class add_filter('FHEE__content_espresso_events__event_class', array($this, 'event_list_css'), 10, 1); // the current "page" we are viewing $paged = max(1, get_query_var('paged')); // Force these args $args = array_merge($args, array('post_type' => 'espresso_events', 'posts_per_page' => $this->_limit, 'update_post_term_cache' => FALSE, 'update_post_meta_cache' => FALSE, 'paged' => $paged, 'offset' => ($paged - 1) * $this->_limit)); // run the query parent::__construct($args); }
/** * run - initial module setup - this gets called by the EE_Front_Controller if the module route is found in the incoming request * * @access public * @param WP $WP * @return void */ public function run($WP) { do_action('AHEE__EED_Events_Archive__before_run'); // ensure valid EE_Events_Archive_Config() object exists $this->set_config(); // load other required components $this->load_event_list_assets(); // filter the WP posts_join, posts_where, and posts_orderby SQL clauses EE_Registry::instance()->load_helper('Event_Query'); EEH_Event_Query::filter_query_parts(); EEH_Event_Query::set_query_params(); // check what template is loaded add_filter('template_include', array($this, 'template_include'), 999, 1); add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true'); }