/*******************************************************************/ ob_start(); ?> <h2 class="tribe-events-page-title"><?php tribe_events_title(); ?> </h2> <?php $title_content = ob_get_clean(); /*******************************************************************/ ?> <?php do_action('tribe_events_before_header'); /*******************************************************************/ $registered_views = tribe_events_get_views(); foreach ($registered_views as $view) { $current_view = $view["displaying"]; if (tribe_is_view($current_view)) { $selected_view = $current_view; } } $selected_view = isset($selected_view) ? $selected_view : "month"; $selected_view = $selected_view == "upcoming" ? "list" : $selected_view; /*******************************************************************/ ?> <div id="tribe-events-header" <?php tribe_events_the_header_attributes(); ?> > <?php
/** * Events Navigation Bar Module Template * Renders our events navigation bar used across our views * * $filters and $views variables are loaded in and coming from * the show funcion in: lib/Bar.php * * @package TribeEventsCalendar * */ ?> <?php $filters = tribe_events_get_filters(); $views = tribe_events_get_views(); $current_url = tribe_events_get_current_filter_url(); ?> <?php do_action('tribe_events_bar_before_template'); ?> <div id="tribe-events-bar"> <form id="tribe-bar-form" class="tribe-clearfix" name="tribe-bar-form" method="post" action="<?php echo esc_attr($current_url); ?> "> <!-- Mobile Filters Toggle -->
/** * Sets the view attribute. * * In priority order, will use one of the following to set the view attribute: * * 1) The value of "eventDisplay" in the URL query, if set and if valid * 2) The value of the "view" attribute provided to the shortcode, if set and if valid * 3) The first view that is available * 4) Month view */ protected function set_view_attribute() { $valid_views = wp_list_pluck(tribe_events_get_views(), 'displaying'); $url_view = $this->get_url_param('tribe_event_display'); $view_attr = $this->get_attribute('view', 'month'); // If tribe_event_display is "past", we need to grab the view from the action parameter if ('past' === $url_view) { $url_view = str_replace('tribe_', '', $this->get_url_param('action')); // Convert the "geosearch" portion of "tribe_geosearch" to "map" so Map view can properly be initialized // @TODO: restructure map view to use tribe_map rather than tribe_geosearch if ('geosearch' === $url_view) { $url_view = 'map'; } } // Look first of all at the URL query for a valid view if (in_array($url_view, $valid_views)) { $this->atts['view'] = $url_view; return; } // Else fallback on the view attribute supplied to the shortcode if (in_array($view_attr, $valid_views)) { $this->atts['view'] = $view_attr; return; } // Otherwise, use the first view that *is* available if (!empty($valid_views)) { $this->atts['view'] = current($valid_views); return; } // If all else fails, we'll try to use month view even if not currently activated $this->atts['view'] = 'month'; }