/** * use_sortable_display_order * * @access protected * @return string */ protected static function use_sortable_display_order() { // no further password checks required atm add_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); // we need to first remove this callback from being applied to the_content() or the_excerpt() (otherwise it will recurse and blow up the interweb) remove_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100); remove_filter('the_content', array('EED_Events_Archive', 'event_details'), 100); remove_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1); // now add additional content depending on whether event is using the_excerpt() or the_content() EED_Events_Archive::instance()->template_parts = EED_Events_Archive::instance()->initialize_template_parts(); $content = EEH_Template::locate_template('content-espresso_events-details.php'); $content = EED_Events_Archive::instance()->template_parts->apply_template_part_filters($content); // re-add our main filters (or else the next event won't have them) add_filter('the_excerpt', array('EED_Events_Archive', 'event_details'), 100, 1); add_filter('the_content', array('EED_Events_Archive', 'event_details'), 100, 1); add_filter('get_the_excerpt', array('EED_Events_Archive', 'get_the_excerpt'), 1, 1); remove_filter('FHEE__EED_Events_Archive__event_details__no_post_password_required', '__return_true'); return $content; }
/** * espresso_load_event_list_assets * ensures that event list styles and scripts are loaded * * @return object */ function espresso_load_event_list_assets() { $event_list = EED_Events_Archive::instance(); add_action('AHEE__EE_System__initialize_last', array($event_list, 'load_event_list_assets'), 10); add_filter('FHEE_enable_default_espresso_css', '__return_true'); }
/** * process_shortcode - ESPRESSO_EVENTS - Returns a list of events * [ESPRESSO_EVENTS] * [ESPRESSO_EVENTS title="My Super Event"] * [ESPRESSO_EVENTS limit=5] * [ESPRESSO_EVENTS css_class="my-custom-class"] * [ESPRESSO_EVENTS month="April 2014"] * [ESPRESSO_EVENTS show_expired=true] * [ESPRESSO_EVENTS category_slug="free-events"] * [ESPRESSO_EVENTS order_by="start_date,id"] * [ESPRESSO_EVENTS sort="ASC"] * * @access public * @param array $attributes * @return string */ public function process_shortcode($attributes = array()) { // make sure EED_Events_Archive is setup properly if (apply_filters('FHEE__fallback_shortcode_processor__EES_Espresso_Events', FALSE)) { EED_Events_Archive::instance()->event_list(); } // merge in any attributes passed via fallback shortcode processor $attributes = array_merge((array) $attributes, (array) $this->_attributes); //set default attributes $default_espresso_events_shortcode_atts = array('title' => NULL, 'limit' => 10, 'css_class' => NULL, 'show_expired' => FALSE, 'month' => NULL, 'category_slug' => NULL, 'order_by' => 'start_date', 'sort' => 'ASC', 'fallback_shortcode_processor' => FALSE); // allow the defaults to be filtered $default_espresso_events_shortcode_atts = apply_filters('EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts', $default_espresso_events_shortcode_atts); // grab attributes and merge with defaults, then extract $attributes = array_merge($default_espresso_events_shortcode_atts, $attributes); // make sure we use the_excerpt() add_filter('FHEE__EES_Espresso_Events__process_shortcode__true', '__return_true'); // run the query global $wp_query; $wp_query = new EE_Event_List_Query($attributes); // check what template is loaded and load filters accordingly EED_Events_Archive::instance()->template_include('loop-espresso_events.php'); // load our template $event_list = EEH_Template::locate_template('loop-espresso_events.php', array(), TRUE, TRUE); // now reset the query and postdata wp_reset_query(); wp_reset_postdata(); EED_Events_Archive::remove_all_events_archive_filters(); // pull our content from the output buffer and return it return $event_list; }
/** * template_settings_form * * @access public * @static * @return void */ public static function template_settings_form() { // grab general settings admin page and remove the existing hook callback $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings'); if ($gen_set_admin instanceof General_Settings_Admin_Page) { remove_action('AHEE__template_settings__template__before_settings_form', array($gen_set_admin, 'template_settings_caff_features'), 100); } // first just grab the template settings $config = EE_Registry::instance()->CFG->template_settings; // then if the Event Archive config is valid, use that, else create a new one $config = isset($config->EED_Events_Archive) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config(); $config = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config); $config->display_status_banner = isset($config->display_status_banner) ? $config->display_status_banner : 0; $config->display_description = isset($config->display_description) ? $config->display_description : 1; $config->display_ticket_selector = isset($config->display_ticket_selector) ? $config->display_ticket_selector : 0; $config->display_datetimes = isset($config->display_datetimes) ? $config->display_datetimes : 1; $config->display_venue = isset($config->display_venue) ? $config->display_venue : 0; $config->display_expired_events = isset($config->display_expired_events) ? $config->display_expired_events : 0; // display order options $config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false; $config->display_order_tickets = isset($config->display_order_tickets) ? $config->display_order_tickets : 100; $config->display_order_datetimes = isset($config->display_order_datetimes) ? $config->display_order_datetimes : 110; $config->display_order_event = isset($config->display_order_event) ? $config->display_order_event : 120; $config->display_order_venue = isset($config->display_order_venue) ? $config->display_order_venue : 130; // get template parts $template_parts = EED_Events_Archive::instance()->initialize_template_parts($config); // convert to array so that we can add more properties $config = get_object_vars($config); $config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js'); EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $config); }