/** * Set up hooks for this template * * @return void **/ protected function hooks() { parent::hooks(); add_filter('tribe_get_template_part_templates', array($this, 'remove_list_navigation'), 10, 3); // Print JSON-LD markup on the `wp_head` add_action('wp_head', array(Tribe__Events__JSON_LD__Organizer::instance(), 'markup')); }
protected function setup() { Tribe__Events__Main::instance()->displaying = 'day'; $this->shortcode->prepare_default(); Tribe__Events__Pro__Template_Factory::asset_package('ajax-dayview'); $this->shortcode->set_template_object(new Tribe__Events__Template__Day($this->shortcode->get_query_args())); }
/** * Set up hooks for this template * * @return void **/ protected function hooks() { parent::hooks(); add_action('tribe_events_single_organizer_before_upcoming_events', array($this, 'setup_upcoming_events')); add_filter('tribe_get_template_part_templates', array($this, 'remove_list_navigation'), 10, 3); // google data markup add_action('wp_head', array($this, 'google_data_markup')); }
protected function setup() { Tribe__Events__Main::instance()->displaying = 'photo'; $this->shortcode->set_current_page(); $this->shortcode->prepare_default(); Tribe__Events__Pro__Main::instance()->enqueue_pro_scripts(); Tribe__Events__Pro__Template_Factory::asset_package('events-pro-css'); Tribe__Events__Pro__Template_Factory::asset_package('ajax-photoview'); $this->shortcode->set_template_object(new Tribe__Events__Pro__Templates__Photo($this->shortcode->get_query_args())); }
public function __construct($attributes) { $this->arguments = shortcode_atts($this->default_args, $attributes); $this->parse_args(); $this->set_date(); // If we don't have an event date we cannot display the timer if (!isset($this->arguments['event_date'])) { return; } // If the ECP CSS has not already been added lets lazily add it now Tribe__Events__Pro__Template_Factory::asset_package('events-pro-css'); ob_start(); the_widget('Tribe__Events__Pro__Countdown_Widget', $this->arguments, $this->arguments); $this->output = ob_get_clean(); }
/** * Setup meta display in this template * * @return void **/ public function setup_meta() { parent::setup_meta(); // setup the template for the meta group tribe_set_the_meta_template('tribe_event_venue', array('before' => '', 'after' => '', 'label_before' => '', 'label_after' => '', 'meta_before' => '<address class="venue-address">', 'meta_after' => '</address>'), 'meta_group'); // setup the template for the meta items tribe_set_the_meta_template(array('tribe_event_venue_address', 'tribe_event_venue_phone', 'tribe_event_venue_website'), array('before' => '', 'after' => '', 'label_before' => '', 'label_after' => '', 'meta_before' => '<span class="%s">', 'meta_after' => '</span>')); // turn off the venue name in the group tribe_set_the_meta_visibility('tribe_event_venue_name', false); // remove the title for the group & meta items tribe_set_meta_label('tribe_event_venue', '', 'meta_group'); tribe_set_meta_label(array('tribe_event_venue_address' => '', 'tribe_event_venue_phone' => '', 'tribe_event_venue_website' => '')); // set meta item priorities tribe_set_meta_priority(array('tribe_event_venue_address' => 10, 'tribe_event_venue_phone' => 20, 'tribe_event_venue_website' => 30)); add_filter('tribe_event_meta_venue_address_gmap', '__return_false'); // disable venue info from showing on list module (since it's duplicate of this view) tribe_set_the_meta_visibility('tribe_list_venue_name_address', false); }
/** * Enqueue the proper PRO scripts as necessary. * * @return void */ public function enqueue_pro_scripts() { if (tribe_is_event_query()) { // @TODO filter the tribe_events_resource_url() function $path = Tribe__Events__Pro__Template_Factory::getMinFile(tribe_events_pro_resource_url('tribe-events-pro.js'), true); wp_enqueue_script('tribe-events-pro', $path, array('jquery', 'tribe-events-calendar-script'), apply_filters('tribe_events_pro_js_version', self::VERSION), false); $geoloc = Tribe__Events__Pro__Geo_Loc::instance(); $data = array('geocenter' => $geoloc->estimate_center_point(), 'map_tooltip_event' => __('Event: ', 'tribe-events-calendar-pro'), 'map_tooltip_address' => __('Address: ', 'tribe-events-calendar-pro')); $data = apply_filters('tribe_events_pro_localize_script', $data, 'Tribe__Events__Pro__Main', 'tribe-events-pro'); wp_localize_script('tribe-events-pro', 'TribeEventsPro', $data); } }
/** * Add/remove filters to hide/show sensitive event info on password protected posts * * @param $post * * @return void * @see 'the_post' **/ public function manage_sensitive_info($post) { parent::manage_sensitive_info($post); if (post_password_required($post)) { add_filter('tribe_get_template_part_path_pro/week/single-event-tooltip.php', '__return_false'); } else { remove_filter('tribe_get_template_part_path_pro/week/single-event-tooltip.php', '__return_false'); } }
/** * Set up hooks for map view * * @return void **/ protected function hooks() { parent::hooks(); add_filter('tribe_events_header_attributes', array($this, 'header_attributes')); add_action('tribe_events_list_before_the_event_title', array($this, 'add_event_distance')); }
/** * Enqueue the maps JS in all the views (Needed for the location filter in the Tribe Bar) */ public function scripts() { if (tribe_is_event_query() && !is_single()) { Tribe__Events__Pro__Template_Factory::asset_package('ajax-maps'); } }
/** * Take care of common setup needs including enqueing various assets required by the default views. */ public function prepare_default() { global $wp_query; /** * We overwrite the global $wp_query object to facilitate embedding the requested view (the * original will be restored during tribe_events_pro_tribe_events_shortcode_post_render): * this isn't ideal, but further restructuring of our template classes and event views would * be needed to avoid it. * * @see $this->reset_query() * @todo revise in a future release */ $wp_query = new WP_Query($this->query_args); // Assets required by all our supported views wp_enqueue_script('jquery'); Tribe__Events__Template_Factory::asset_package('bootstrap-datepicker'); Tribe__Events__Template_Factory::asset_package('calendar-script'); Tribe__Events__Template_Factory::asset_package('jquery-resize'); Tribe__Events__Template_Factory::asset_package('events-css'); Tribe__Events__Pro__Template_Factory::asset_package('events-pro-css'); // Tribe Events Bar support if ($this->is_attribute_truthy('tribe-bar', true)) { add_filter('tribe_get_option', array($this, 'filter_tribe_disable_bar'), 10, 2); // Make sure the filters have been initialized tribe_events_get_filters(); add_filter('tribe-events-bar-should-show', array($this, 'enable_tribe_bar')); remove_action('tribe_events_bar_before_template', array(Tribe__Events__Bar::instance(), 'disabled_bar_before')); remove_action('tribe_events_bar_after_template', array(Tribe__Events__Bar::instance(), 'disabled_bar_after')); Tribe__Events__Template_Factory::asset_package('jquery-placeholder'); Tribe__Events__Pro__Template_Factory::asset_package('ajax-maps'); Tribe__Events__Template_Factory::asset_package('jquery-resize'); add_action('tribe_events_bar_before_template', array(Tribe__Events__Bar::instance(), 'disabled_bar_before')); add_action('tribe_events_bar_after_template', array(Tribe__Events__Bar::instance(), 'disabled_bar_after')); remove_filter('tribe_get_option', array($this, 'filter_tribe_disable_bar')); } // Add the method responsible for rendering each of the default supported views add_filter('tribe_events_pro_tribe_events_shortcode_output', array($this, 'render_view')); // View selector URLs will need to be adjusted (so that the user is not taken to /events/new-view/) add_filter('tribe-events-bar-views', array($this, 'modify_view_urls'), 100); }
protected function hooks() { parent::hooks(); add_filter('tribe_events_header_attributes', array($this, 'header_attributes')); }