function enqueue_month_view_scripts() { if (is_front_page()) { Tribe__Events__Template_Factory::asset_package('ajax-calendar'); Tribe__Events__Template_Factory::asset_package('events-css'); } }
public function load_assets($hook) { if ('widgets.php' !== $hook) { return; } Tribe__Events__Template_Factory::asset_package('select2'); wp_enqueue_script('tribe-admin-widget-countdown', tribe_events_pro_resource_url('admin-widget-countdown.js'), array('jquery'), apply_filters('tribe_events_pro_js_version', Tribe__Events__Pro__Main::VERSION)); }
public function load_scripts($hook) { if ($hook != 'widgets.php') { return; } Tribe__Events__Template_Factory::asset_package('select2'); wp_enqueue_script('calendar-widget-admin', tribe_events_pro_resource_url('calendar-widget-admin.js'), array(), apply_filters('tribe_events_pro_js_version', Tribe__Events__Pro__Main::VERSION)); }
protected function setup() { Tribe__Events__Main::instance()->displaying = 'month'; $this->set_current_month(); $this->shortcode->prepare_default(); Tribe__Events__Template_Factory::asset_package('ajax-calendar'); $this->shortcode->set_template_object(new Tribe__Events__Template__Month($this->shortcode->get_query_args())); }
protected function setup() { Tribe__Events__Main::instance()->displaying = 'list'; $this->shortcode->set_current_page(); $this->shortcode->prepare_default(); Tribe__Events__Template_Factory::asset_package('ajax-list'); $this->template = new Tribe__Events__Template__List($this->shortcode->get_query_args()); $this->shortcode->set_template_object($this->template); }
protected function setup() { Tribe__Events__Main::instance()->displaying = 'map'; $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__Template_Factory::asset_package('jquery-placeholder'); Tribe__Events__Pro__Template_Factory::asset_package('ajax-maps'); $this->shortcode->set_template_object(new Tribe__Events__Pro__Templates__Map($this->shortcode->get_query_args())); }
/** * @param $hook */ public function load_scripts($hook) { if ('widgets.php' != $hook) { return; } //JS for Taxonomy Filter Select Tribe__Events__Template_Factory::asset_package('select2'); wp_enqueue_script('calendar-widget-admin', tribe_events_pro_resource_url('calendar-widget-admin.js'), array(), apply_filters('tribe_events_pro_js_version', Tribe__Events__Pro__Main::VERSION)); //Need for Customizer and to prevent errors in Widgets Section with Color Picker wp_enqueue_script('underscore'); //Colorpicker wp_enqueue_style('wp-color-picker'); wp_enqueue_script('wp-color-picker'); }
/** * Load asset packages. * * @return void */ public function loadStyle() { if (tribe_is_event_query() || tribe_is_event_organizer() || tribe_is_event_venue()) { // jquery-resize Tribe__Events__Template_Factory::asset_package('jquery-resize'); // smoothness Tribe__Events__Template_Factory::asset_package('smoothness'); // Tribe Calendar JS Tribe__Events__Template_Factory::asset_package('calendar-script'); Tribe__Events__Template_Factory::asset_package('events-css'); } else { if (is_active_widget(false, false, 'tribe-events-list-widget')) { Tribe__Events__Template_Factory::asset_package('events-css'); } } }
/** * Actually create the shortcode output * * @since 4.1 * * @param array $args The Shortcode arguments * * @return string */ public function do_shortcode($args) { $tag = $this->get_shortcode_tag(); $slug = $this->get_shortcode_slug(); $args = (object) shortcode_atts(array('align' => 'left', 'id' => null), $args, $tag); if (!is_null($args->id) && is_numeric($args->id)) { $event = get_post($args->id); // Then If Event was fetch correctly we set the global if ($event) { global $post; // Store the Original we will restore it later $original_event = $post; // Set the new Event for now $post = $event; // Use WP to config the Post Data setup_postdata($post); } } // Set the Container Classes $classes = array('tribe-shortcode', 'tribe-events-single-section', 'tribe-events-event-meta', 'tribe-clearfix'); // Add Alignment if (in_array($args->align, array('center', 'left', 'right'))) { $classes[] = 'tribe-shortcode-align-' . $args->align; } /** * Use this hook to filter the classes for this shortcode container * * @since 4.1 * * @param array Array of classes used on the Container * @param object Arguments set on the shortcode * @param string Shortcode tag */ $classes = apply_filters('tribe_events_shortcode_' . $slug . '_container_classes', $classes, $args, $tag); // Ensure the expected CSS is available to style the shortcode output (this will // happen automatically in event views, but not elsewhere) Tribe__Events__Template_Factory::asset_package('events-css'); // Start to record the Output ob_start(); echo '<div class="' . esc_attr(implode(' ', $classes)) . '">'; // Print the Actual HTML tribe_get_template_part('modules/meta/details'); echo '</div>'; // Save it to a variable $html = ob_get_clean(); if (isset($original_event)) { $post = $original_event; // Use WP method to restore it back to original setup_postdata($post); } return $html; }
/** * Load the CSSs and JSs only if the Bar will be shown */ public function load_script() { if ($this->should_show()) { Tribe__Events__Template_Factory::asset_package('jquery-placeholder'); Tribe__Events__Template_Factory::asset_package('bootstrap-datepicker'); Tribe__Events__Template_Factory::asset_package('tribe-events-bar'); do_action('tribe-events-bar-enqueue-scripts'); } }
/** * Enqueue the plugin stylesheet(s). * * @author PaulHughes01 * @since 3.4 * @return void */ public function enqueueStylesAndScripts() { if (tribe_is_event_query() || tribe_is_event_organizer() || tribe_is_event_venue()) { $show_filter = apply_filters('tribe_events_filters_should_show', in_array(get_post_type(), array(Tribe__Events__Main::VENUE_POST_TYPE, Tribe__Events__Main::ORGANIZER_POST_TYPE)) ? false : true); if ($show_filter) { //Only display filters before template if the layout is horizontal if (tribe_get_option('events_filters_layout', 'vertical') == 'vertical') { add_action('tribe_events_bar_after_template', array($this, 'displaySidebar'), 25); } else { if (tribe_get_option('tribeDisableTribeBar', false) == true) { add_action('tribe_events_before_template', array($this, 'displaySidebar'), 25); } else { add_action('tribe_events_bar_after_template', array($this, 'displaySidebar'), 25); } } } // enqueue chosen for tag multi-select Tribe__Events__Template_Factory::asset_package('chosen'); Tribe__Events__Template_Factory::asset_package('calendar-script', array('jquery-ui-slider')); wp_enqueue_style('custom-jquery-styles'); wp_enqueue_style('Tribe__Events__Filterbar__View-css', Tribe__Events__Template_Factory::getMinFile($this->pluginUrl . 'src/resources/css/filter-view.css', true), array(), apply_filters('tribe_events_filters_css_version', self::VERSION)); wp_enqueue_script('jquery-ui-slider'); wp_enqueue_script('Tribe__Events__Filterbar__View-scripts', Tribe__Events__Template_Factory::getMinFile($this->pluginUrl . 'src/resources/js/filter-scripts.js', true), array(), apply_filters('tribe_events_filters_js_version', self::VERSION)); //Check for override stylesheet $user_stylesheet_url = Tribe__Events__Templates::locate_stylesheet('tribe-events/filterbar/filter-view.css'); $user_stylesheet_url = apply_filters('tribe_events_filterbar_stylesheet_url', $user_stylesheet_url); //If override stylesheet exists, then enqueue it if ($user_stylesheet_url) { wp_enqueue_style('tribe-events-filterbar-override-style', $user_stylesheet_url); } } }
/** * 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); }