/** * AJAX handler for the Map view */ public function ajax_response() { $tribe_paged = !empty($_POST['tribe_paged']) ? $_POST['tribe_paged'] : 1; Tribe__Events__Query::init(); $post_status = array('publish'); if (is_user_logged_in()) { $post_status[] = 'private'; } $defaults = array('post_type' => Tribe__Events__Main::POSTTYPE, 'posts_per_page' => tribe_get_option('postsPerPage', 10), 'paged' => $tribe_paged, 'post_status' => $post_status, 'eventDisplay' => 'map', 'tribe_geoloc' => true); $view_state = 'map'; /* if past view */ if (!empty($_POST['tribe_event_display']) && $_POST['tribe_event_display'] == 'past') { $view_state = 'past'; $defaults['eventDisplay'] = 'past'; $defaults['order'] = 'DESC'; } if (isset($_POST['tribe_event_category'])) { $defaults[Tribe__Events__Main::TAXONOMY] = $_POST['tribe_event_category']; } if (isset($_POST[Tribe__Events__Main::TAXONOMY])) { $defaults[Tribe__Events__Main::TAXONOMY] = $_POST[Tribe__Events__Main::TAXONOMY]; } $query = Tribe__Events__Query::getEvents($defaults, true); $have_events = 0 < $query->found_posts; if ($have_events && Tribe__Events__Pro__Geo_Loc::instance()->is_geoloc_query()) { $lat = isset($_POST['tribe-bar-geoloc-lat']) ? $_POST['tribe-bar-geoloc-lat'] : 0; $lng = isset($_POST['tribe-bar-geoloc-lng']) ? $_POST['tribe-bar-geoloc-lng'] : 0; Tribe__Events__Pro__Geo_Loc::instance()->assign_distance_to_posts($query->posts, $lat, $lng); } elseif (!$have_events && isset($_POST['tribe-bar-geoloc'])) { Tribe__Notice::set_notice('event-search-no-results', sprintf(__('No results were found for events in or near <strong>"%s"</strong>.', 'tribe-events-calendar-pro'), esc_html($_POST['tribe-bar-geoloc']))); } elseif (!$have_events && isset($_POST['tribe_event_category'])) { Tribe__Notice::set_notice('events-not-found', sprintf(__('No matching events listed under %s. Please try viewing the full calendar for a complete list of events.', 'tribe-events-calendar-pro'), esc_html($_POST['tribe_event_category']))); } elseif (!$have_events) { Tribe__Notice::set_notice('event-search-no-results', __('There were no results found.', 'tribe-events-calendar-pro')); } $response = array('html' => '', 'markers' => array(), 'success' => true, 'tribe_paged' => $tribe_paged, 'max_pages' => $query->max_num_pages, 'total_count' => $query->found_posts, 'view' => $view_state); // @TODO: clean this up / refactor the following conditional if ($have_events) { global $wp_query, $post; $data = $query->posts; $post = $query->posts[0]; $wp_query = $query; Tribe__Events__Main::instance()->displaying = 'map'; ob_start(); tribe_get_view('pro/map/content'); $response['html'] .= ob_get_clean(); $response['markers'] = Tribe__Events__Pro__Geo_Loc::instance()->generate_markers($data); } else { global $wp_query; $wp_query = $query; Tribe__Events__Main::instance()->setDisplay(); ob_start(); tribe_get_view('pro/map/content'); $response['html'] .= ob_get_clean(); } $response = apply_filters('tribe_events_ajax_response', $response); header('Content-type: application/json'); echo json_encode($response); exit; }
/** * List view ajax handler * */ public function ajax_response() { Tribe__Events__Query::init(); $tribe_paged = !empty($_POST['tribe_paged']) ? intval($_POST['tribe_paged']) : 1; $post_status = array('publish'); if (is_user_logged_in()) { $post_status[] = 'private'; } $args = array('eventDisplay' => 'list', 'post_type' => Tribe__Events__Main::POSTTYPE, 'post_status' => $post_status, 'paged' => $tribe_paged); // check & set display if (isset($_POST['tribe_event_display'])) { if ($_POST['tribe_event_display'] == 'past') { $args['eventDisplay'] = 'past'; $args['order'] = 'DESC'; } elseif ('all' == $_POST['tribe_event_display']) { $args['eventDisplay'] = 'all'; } } // check & set event category if (isset($_POST['tribe_event_category'])) { $args[Tribe__Events__Main::TAXONOMY] = $_POST['tribe_event_category']; } $args = apply_filters('tribe_events_listview_ajax_get_event_args', $args, $_POST); $query = tribe_get_events($args, true); // $hash is used to detect whether the primary arguments in the query have changed (i.e. due to a filter bar request) // if they have, we want to go back to page 1 $hash = $query->query_vars; $hash['paged'] = null; $hash['start_date'] = null; $hash['end_date'] = null; $hash_str = md5(maybe_serialize($hash)); if (!empty($_POST['hash']) && $hash_str !== $_POST['hash']) { $tribe_paged = 1; $args['paged'] = 1; $query = Tribe__Events__Query::getEvents($args, true); } $response = array('html' => '', 'success' => true, 'max_pages' => $query->max_num_pages, 'hash' => $hash_str, 'tribe_paged' => $tribe_paged, 'total_count' => $query->found_posts, 'view' => 'list'); global $wp_query, $post, $paged; $wp_query = $query; if (!empty($query->posts)) { $post = $query->posts[0]; } $paged = $tribe_paged; Tribe__Events__Main::instance()->displaying = apply_filters('tribe_events_listview_ajax_event_display', 'list', $args); if (!empty($_POST['tribe_event_display']) && $_POST['tribe_event_display'] == 'past') { $response['view'] = 'past'; } ob_start(); tribe_get_view('list/content'); $response['html'] .= ob_get_clean(); apply_filters('tribe_events_ajax_response', $response); header('Content-type: application/json'); echo json_encode($response); die; }
/** * AJAX handler for Photo view * * @return void */ public function ajax_response() { $tec = Tribe__Events__Main::instance(); Tribe__Events__Query::init(); $tribe_paged = !empty($_POST['tribe_paged']) ? intval($_POST['tribe_paged']) : 1; $post_status = array('publish'); if (is_user_logged_in()) { $post_status[] = 'private'; } $args = array('eventDisplay' => 'list', 'post_type' => Tribe__Events__Main::POSTTYPE, 'post_status' => $post_status, 'paged' => $tribe_paged); $view_state = 'photo'; if (isset($_POST['tribe_event_category'])) { $args[Tribe__Events__Main::TAXONOMY] = $_POST['tribe_event_category']; } /* if past view */ if (!empty($_POST['tribe_event_display']) && $_POST['tribe_event_display'] == 'past') { $view_state = 'past'; $args['eventDisplay'] = 'past'; $args['order'] = 'DESC'; } $query = Tribe__Events__Query::getEvents($args, true); $hash = $query->query_vars; $hash['paged'] = null; $hash['start_date'] = null; $hash_str = md5(maybe_serialize($hash)); if (!empty($_POST['hash']) && $hash_str !== $_POST['hash']) { $tribe_paged = 1; $args['paged'] = 1; $query = Tribe__Events__Query::getEvents($args, true); } $response = array('html' => '', 'success' => true, 'max_pages' => $query->max_num_pages, 'hash' => $hash_str, 'tribe_paged' => $tribe_paged, 'view' => $view_state); global $wp_query, $post; $wp_query = $query; if (!empty($query->posts)) { $post = $query->posts[0]; } add_filter('tribe_events_list_pagination', array('Tribe__Events__Main', 'clear_module_pagination'), 10); $tec->displaying = 'photo'; ob_start(); tribe_get_view('pro/photo/content'); $response['html'] .= ob_get_clean(); apply_filters('tribe_events_ajax_response', $response); header('Content-type: application/json'); echo json_encode($response); die; }
/** * Month View Ajax Handler * */ public function ajax_response() { if (isset($_POST['eventDate']) && $_POST['eventDate']) { Tribe__Events__Query::init(); Tribe__Events__Main::instance()->displaying = 'month'; global $wp_query; $wp_query = tribe_get_events($this->args, true); ob_start(); tribe_get_view('month/content'); $response = array('html' => ob_get_clean(), 'success' => true, 'view' => 'month'); apply_filters('tribe_events_ajax_response', $response); header('Content-type: application/json'); echo json_encode($response); die; } }
/** * Executes the iCal generator when the appropiate query_var or $_GET is setup * * @static * * @param $template */ public static function do_ical_template($template) { // hijack to iCal template if (get_query_var('ical') || isset($_GET['ical'])) { global $wp_query; if (isset($_GET['event_ids'])) { if (empty($_GET['event_ids'])) { die; } $event_ids = explode(',', $_GET['event_ids']); $events = Tribe__Events__Query::getEvents(array('post__in' => $event_ids)); self::generate_ical_feed($events); } elseif (is_single()) { self::generate_ical_feed($wp_query->post, null); } else { self::generate_ical_feed(); } die; } }
public function setup_list($template_file) { if (basename(dirname($template_file)) . '/' . basename($template_file) == 'mini-calendar/list.php') { if ($this->args['count'] == 0) { return; } // make sure the widget taxonomy filter setting is respected add_action('pre_get_posts', array($this, 'set_count'), 1000); global $wp_query; $post_status = array('publish'); if (is_user_logged_in()) { $post_status[] = 'private'; } // hijack the main query to load the events via provided $args if (!is_null($this->args)) { $query_args = array('posts_per_page' => $this->args['count'], 'tax_query' => $this->args['tax_query'], 'eventDisplay' => 'custom', 'start_date' => $this->get_month(), 'post_status' => $post_status, 'is_tribe_widget' => true); // set end date if initial load, or ajax month switch if (!defined('DOING_AJAX') || defined('DOING_AJAX') && $_POST['action'] == 'tribe-mini-cal') { $query_args['end_date'] = substr_replace($this->get_month(Tribe__Events__Date_Utils::DBDATEFORMAT), Tribe__Events__Date_Utils::get_last_day_of_month(strtotime($this->get_month())), -2); // @todo use tribe_events_end_of_day() ? $query_args['end_date'] = tribe_event_end_of_day($query_args['end_date']); } $wp_query = Tribe__Events__Query::getEvents($query_args, true); } } }
/** * Month View Ajax Handler * * @return void */ function ajax_response() { if (isset($_POST['eventDate']) && $_POST['eventDate']) { Tribe__Events__Query::init(); $post_status = array('publish'); if (is_user_logged_in()) { $post_status[] = 'private'; } // set the global query var for eventDisplay $query_args = array('post_type' => Tribe__Events__Main::POSTTYPE, 'eventDisplay' => 'month', 'eventDate' => $_POST['eventDate'], 'post_status' => $post_status); Tribe__Events__Main::instance()->displaying = 'month'; if (isset($_POST['tribe_event_category'])) { $query_args['tribe_events_cat'] = $_POST['tribe_event_category']; } query_posts($query_args); ob_start(); tribe_get_view('month/content'); $response = array('html' => ob_get_clean(), 'success' => true, 'view' => 'month'); apply_filters('tribe_events_ajax_response', $response); header('Content-type: application/json'); echo json_encode($response); die; } }
/** * Run on applied action init */ public function init() { $this->pluginName = __('The Events Calendar', 'the-events-calendar'); $this->rewriteSlug = $this->getRewriteSlug(); $this->rewriteSlugSingular = $this->getRewriteSlugSingular(); $this->taxRewriteSlug = $this->getTaxRewriteSlug(); $this->tagRewriteSlug = $this->getTagRewriteSlug(); $this->monthSlug = sanitize_title(__('month', 'the-events-calendar')); $this->listSlug = sanitize_title(__('list', 'the-events-calendar')); $this->upcomingSlug = sanitize_title(__('upcoming', 'the-events-calendar')); $this->pastSlug = sanitize_title(__('past', 'the-events-calendar')); $this->daySlug = sanitize_title(__('day', 'the-events-calendar')); $this->todaySlug = sanitize_title(__('today', 'the-events-calendar')); $this->singular_venue_label = $this->get_venue_label_singular(); $this->plural_venue_label = $this->get_venue_label_plural(); $this->singular_organizer_label = $this->get_organizer_label_singular(); $this->plural_organizer_label = $this->get_organizer_label_plural(); $this->singular_event_label = $this->get_event_label_singular(); $this->plural_event_label = $this->get_event_label_plural(); $this->postTypeArgs['rewrite']['slug'] = sanitize_title($this->rewriteSlugSingular); $this->postVenueTypeArgs['rewrite']['slug'] = sanitize_title($this->singular_venue_label); $this->postVenueTypeArgs['show_in_nav_menus'] = class_exists('Tribe__Events__Pro__Main') ? true : false; $this->postOrganizerTypeArgs['rewrite']['slug'] = sanitize_title($this->singular_organizer_label); $this->postOrganizerTypeArgs['show_in_nav_menus'] = class_exists('Tribe__Events__Pro__Main') ? true : false; $this->postVenueTypeArgs['public'] = class_exists('Tribe__Events__Pro__Main') ? true : false; $this->postOrganizerTypeArgs['public'] = class_exists('Tribe__Events__Pro__Main') ? true : false; $this->currentDay = ''; $this->errors = ''; $this->default_values = apply_filters('tribe_events_default_value_strategy', new Tribe__Events__Default_Values()); Tribe__Events__Query::init(); Tribe__Events__Backcompat::init(); Tribe__Events__Credits::init(); Tribe__Events__Timezones::init(); $this->registerPostType(); self::debug(sprintf(__('Initializing Tribe Events on %s', 'the-events-calendar'), date('M, jS \\a\\t h:m:s a'))); $this->maybeSetTECVersion(); }
/** * AJAX handler for Week view * This loads up the week view shard with all the appropriate events for the week * * @return void */ public function ajax_response() { if (isset($_POST['eventDate']) && $_POST['eventDate']) { Tribe__Events__Query::init(); $post_status = array('publish'); if (is_user_logged_in()) { $post_status[] = 'private'; } $args = array('post_status' => $post_status, 'eventDate' => $_POST['eventDate'], 'eventDisplay' => 'week'); if (isset($_POST['tribe_event_category'])) { $args[Tribe__Events__Main::TAXONOMY] = $_POST['tribe_event_category']; } global $wp_query; $wp_query = Tribe__Events__Query::getEvents($args, true); Tribe__Events__Main::instance()->setDisplay(); $response = array('html' => '', 'success' => true, 'view' => 'week'); add_filter('tribe_is_week', '__return_true'); // simplest way to declare that this is a week view ob_start(); tribe_get_view('pro/week/content'); $response['html'] .= ob_get_clean(); apply_filters('tribe_events_ajax_response', $response); header('Content-type: application/json'); echo json_encode($response); die; } }
/** * Include the List view * * Accepts an array of query arguments, retrieves them, and returns the html for those events in list view * * Optional inline example: * < code > * <?php * echo myfunction(); * ?> * </ code > * * @category Events * * @param array $args Args to be passed to Tribe__Events__Query::getEvents() * @param bool $initialize Whether the list view template class needs to be included and initialized * * @return string **/ function tribe_include_view_list($args = null, $initialize = true) { global $wp_query; // hijack the main query to load the events via provided $args if (!is_null($args) || !($wp_query->tribe_is_event || $wp_query->tribe_is_event_category)) { $reset_q = $wp_query; $wp_query = Tribe__Events__Query::getEvents($args, true); } // single-event notices are jumping in on this init when loading as a module Tribe__Events__Main::removeNotice('event-past'); // get the list view template ob_start(); if ($initialize) { tribe_initialize_view('Tribe__Events__Template__List'); } tribe_get_view('list/content'); $list_view_html = ob_get_clean(); // fix the error of our ways if (!empty($reset_q)) { $wp_query = $reset_q; } // return the parsed template return $list_view_html; }
/** * AJAX handler for tribe_event_day (dayview navigation) * This loads up the day view shard with all the appropriate events for the day * * @return void */ function ajax_response() { if (isset($_POST['eventDate']) && $_POST['eventDate']) { Tribe__Events__Query::init(); $post_status = array('publish'); if (is_user_logged_in()) { $post_status[] = 'private'; } $args = array('post_status' => $post_status, 'eventDate' => $_POST["eventDate"], 'eventDisplay' => 'day'); Tribe__Events__Main::instance()->displaying = 'day'; if (isset($_POST['tribe_event_category'])) { $args[Tribe__Events__Main::TAXONOMY] = $_POST['tribe_event_category']; } $query = Tribe__Events__Query::getEvents($args, true); global $wp_query, $post; $wp_query = $query; add_filter('tribe_is_day', '__return_true'); // simplest way to declare that this is a day view ob_start(); tribe_get_view('day/content'); $response = array('html' => ob_get_clean(), 'success' => true, 'total_count' => $query->found_posts, 'view' => 'day'); apply_filters('tribe_events_ajax_response', $response); header('Content-type: application/json'); echo json_encode($response); die; } }
/** * Run on applied action init */ public function init() { $rewrite = Tribe__Events__Rewrite::instance(); $venue = Tribe__Events__Venue::instance(); $organizer = Tribe__Events__Organizer::instance(); $this->postVenueTypeArgs = $venue->post_type_args; $this->postOrganizerTypeArgs = $organizer->post_type_args; $this->pluginName = $this->plugin_name = esc_html__('The Events Calendar', 'the-events-calendar'); $this->rewriteSlug = $this->getRewriteSlug(); $this->rewriteSlugSingular = $this->getRewriteSlugSingular(); $this->category_slug = $this->get_category_slug(); $this->tag_slug = $this->get_tag_slug(); $this->taxRewriteSlug = $this->rewriteSlug . '/' . $this->category_slug; $this->tagRewriteSlug = $this->rewriteSlug . '/' . $this->tag_slug; $this->monthSlug = sanitize_title(__('month', 'the-events-calendar')); $this->listSlug = sanitize_title(__('list', 'the-events-calendar')); $this->upcomingSlug = sanitize_title(__('upcoming', 'the-events-calendar')); $this->pastSlug = sanitize_title(__('past', 'the-events-calendar')); $this->daySlug = sanitize_title(__('day', 'the-events-calendar')); $this->todaySlug = sanitize_title(__('today', 'the-events-calendar')); $this->singular_venue_label = $this->get_venue_label_singular(); $this->plural_venue_label = $this->get_venue_label_plural(); $this->singular_organizer_label = $this->get_organizer_label_singular(); $this->plural_organizer_label = $this->get_organizer_label_plural(); $this->singular_event_label = $this->get_event_label_singular(); $this->plural_event_label = $this->get_event_label_plural(); $this->singular_event_label_lowercase = tribe_get_event_label_singular_lowercase(); $this->plural_event_label_lowercase = tribe_get_event_label_plural_lowercase(); $this->postTypeArgs['rewrite']['slug'] = $rewrite->prepare_slug($this->rewriteSlugSingular, self::POSTTYPE, false); $this->currentDay = ''; $this->errors = ''; $this->default_values = apply_filters('tribe_events_default_value_strategy', new Tribe__Events__Default_Values()); Tribe__Events__Query::init(); Tribe__Events__Backcompat::init(); Tribe__Credits::init(); Tribe__Events__Timezones::init(); $this->registerPostType(); Tribe__Debug::debug(sprintf(esc_html__('Initializing Tribe Events on %s', 'the-events-calendar'), date('M, jS \\a\\t h:m:s a'))); $this->maybeSetTECVersion(); // Start the integrations manager Tribe__Events__Integrations__Manager::instance()->load_integrations(); }
/** * Template tag to get related posts for the current post. * * @param int $count number of related posts to return. * @param int|obj $post the post to get related posts to, defaults to current global $post * * @return array the related posts. */ function tribe_get_related_posts($count = 3, $post = false) { $post_id = Tribe__Events__Main::postIdHelper($post); $tags = wp_get_post_tags($post_id, array('fields' => 'ids')); $categories = wp_get_object_terms($post_id, Tribe__Events__Main::TAXONOMY, array('fields' => 'ids')); if (!$tags && !$categories) { return; } $args = array('posts_per_page' => $count, 'post__not_in' => array($post_id), 'eventDisplay' => 'list', 'tax_query' => array('relation' => 'OR'), 'orderby' => 'rand'); if ($tags) { $args['tax_query'][] = array('taxonomy' => 'post_tag', 'field' => 'id', 'terms' => $tags); } if ($categories) { $args['tax_query'][] = array('taxonomy' => Tribe__Events__Main::TAXONOMY, 'field' => 'id', 'terms' => $categories); } $args = apply_filters('tribe_related_posts_args', $args); if ($args) { $posts = Tribe__Events__Query::getEvents($args); } else { $posts = array(); } return apply_filters('tribe_get_related_posts', $posts); }
function fetch_upcoming() { $query = array('paged' => false, 'posts_per_page' => 1, 'eventDisplay' => 'list'); $upcoming = Tribe__Events__Query::getEvents($query, true); return $upcoming; }
/** * This Week Query * * * @return object */ public static function this_week_query($this_week_query_vars) { //Only Get Private Events if user can view $post_status = array('publish'); if (current_user_can('read_private_tribe_events')) { $post_status[] = 'private'; } //Get Events with Hide From Event Listings Checked $hide_upcoming_ids = Tribe__Events__Query::getHideFromUpcomingEvents(); $this_week_widget_args = array('post_type' => Tribe__Events__Main::POSTTYPE, 'tax_query' => $this_week_query_vars['tax_query'], 'eventDisplay' => 'custom', 'start_date' => $this_week_query_vars['start_date'], 'end_date' => $this_week_query_vars['end_date'], 'post_status' => $post_status, 'tribeHideRecurrence' => false, 'post__not_in' => $hide_upcoming_ids, 'tribe_render_context' => 'widget', 'posts_per_page' => -1); /** * Filter This Week Widget args * * @param array $this_week_widget_args Arguments for This Week Widget */ $this_week_widget_args = apply_filters('tribe_events_pro_this_week_widget_query_args', $this_week_widget_args); // Get all the upcoming events for this week $events = tribe_get_events($this_week_widget_args, true); //Days Array to set events for each day $week_days = array(); //Set First Day $day = $this_week_query_vars['start_date']; //Get Day Range $day_range = self::get_day_range(); //Todays Date According to WordPress $timestamp_today = strtotime(current_time(Tribe__Date_Utils::DBDATEFORMAT)); //Date Formats from The Events Calendar $display_date_format = apply_filters('tribe_events_this_week_date_format', 'jS'); $display_day_format = apply_filters('tribe_events_this_week_day_format', 'D '); // Array used for calculation of php strtotime relative dates $weekday_array = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); //Build an Array for Each Day foreach ($day_range as $i => $day_number) { //If Hide Weekends True then skip those days if ($this_week_query_vars['hide_weekends'] === 'true' && ($day_number == 0 || $day_number == 6)) { continue; } // figure out the $date that we're currently looking at if ($day_number >= $day_range[0]) { // usually we can just get the date for the next day $date = date(Tribe__Date_Utils::DBDATEFORMAT, strtotime($day . "+{$i} days")); } else { //Start Day of week in the Middle and not in typical Sunday or Monday $date = date(Tribe__Date_Utils::DBDATEFORMAT, strtotime("Next {$weekday_array[$day_number]}", strtotime($day))); } $this_week_events_sticky = $this_week_events = array(); if ($events->have_posts()) { //loop through all events and sort based on sticky or not foreach ($events->posts as $j => $event) { if (tribe_event_is_on_date($date, $event)) { $event->days_between = tribe_get_days_between($event->EventStartDate, $event->EventEndDate, true); if ($event->menu_order == -1) { $this_week_events_sticky[] = $event; } else { $this_week_events[] = $event; } } } } //Merge the two arrays for the day only if sticky events are included for that day if (!empty($this_week_events_sticky) && is_array($this_week_events_sticky) && is_array($this_week_events)) { $this_week_events = array_merge($this_week_events_sticky, $this_week_events); } $formatted_date = date_i18n($display_date_format, strtotime($date)); $formatted_day = date_i18n($display_day_format, strtotime($date)); $timestamp_date = strtotime($date); // create the "day" element to do display in the template $week_days[] = array('date' => $date, 'day_number' => $day_number, 'formatted_date' => $formatted_date, 'formatted_day' => $formatted_day, 'is_today' => $timestamp_date == $timestamp_today ? true : false, 'is_past' => $timestamp_date < $timestamp_today ? true : false, 'is_future' => $timestamp_date > $timestamp_today ? true : false, 'this_week_events' => $this_week_events, 'has_events' => $this_week_events, 'total_events' => count($this_week_events), 'events_limit' => $this_week_query_vars['count'], 'view_more' => count($this_week_events) > $this_week_query_vars['count'] ? esc_url_raw(tribe_get_day_link($date)) : false); } return $week_days; }
/** * Event date & upcoming filters SHOULD be removed from event list pages (they do their own date filtering) * * @test */ public function it_should_remove_date_filters_on_event_list() { set_current_screen('edit-' . Tribe__Events__Main::POSTTYPE); $query = new WP_Query(); $query->parse_query(['post_type' => Tribe__Events__Main::POSTTYPE]); if (isset($_GET['page'])) { unset($_GET['page']); } if (isset($_GET['tab'])) { unset($_GET['tab']); } $this->assertTrue(Tribe__Events__Query::should_remove_date_filters($query), 'Date filters should be removed when on the event list page'); }