Tribe__Events__Pro__Main::setup_hide_recurrence_in_query( WP_Query $query )

Sets up to add the query variable for hiding subsequent recurrences of recurring events on the frontend.


Parameters

$query

(WP_Query) (Required) The current query object.


Top ↑

Return

(WP_Query) The modified query object.


Top ↑

Source

File: src/Tribe/Main.php

		public function setup_hide_recurrence_in_query( $query ) {

			if ( ! isset( $query->query_vars['is_tribe_widget'] ) || ! $query->query_vars['is_tribe_widget'] ){
				// don't hide any recurrences on the all recurrences view
				if ( tribe_is_showing_all() || tribe_is_week() || tribe_is_month() || tribe_is_day() ) {
					return $query;
				}
			}

			// don't hide any recurrences in the admin
			if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
				return $query;
			}

			// don't override an explicitly passed value
			if ( isset( $query->query_vars['tribeHideRecurrence'] ) ) {
				return $query;
			}

			// if the admin option is set to hide recurrences, or the user option is set
			if ( $this->should_hide_recurrence( $query ) ) {
				$query->query_vars['tribeHideRecurrence'] = 1;
			}

			return $query;
		}