Tribe__Events__Pro__Main::should_hide_recurrence( WP_Query $query = null )

Returns whether or not we show only the first instance of each recurring event in listview


Parameters

$query

(WP_Query) (Optional) The current query object.

Default value: null


Top ↑

Return

(boolean)


Top ↑

Source

File: src/Tribe/Main.php

		public function should_hide_recurrence( $query = null ) {
			$hide = false;

			if ( tribe_is_showing_all() ) {
				// let's not hide recurrence if we are showing all recurrence events
				$hide = false;
			} elseif ( defined( 'REST_REQUEST' ) && true === REST_REQUEST ) {
				// let's not hide recurrence if we are processing a REST request
				$hide = false;
			} elseif ( ! empty( $_GET['tribe_post_parent'] ) ) {
				// let's not hide recurrence if we are showing all recurrence events via AJAX
				$hide = false;
			} elseif ( ! empty( $_POST['tribe_post_parent'] ) ) {
				// let's not hide recurrence if we are showing all recurrence events via AJAX
				$hide = false;
			} elseif (
				is_object( $query )
				&& ! empty( $query->query['eventDisplay'] )
				&& in_array( $query->query['eventDisplay'], array( 'month', 'week' ) )
			) {
				// let's not hide recurrence if we are on month or week view
				$hide = false;
			} elseif ( tribe_get_option( 'hideSubsequentRecurrencesDefault', false ) ) {
				// let's HIDE recurrence events if we've set the option
				$hide = true;
			} elseif ( isset( $_GET['tribeHideRecurrence'] ) && 1 == $_GET['tribeHideRecurrence'] ) {
				// let's HIDE recurrence events if tribeHideRecurrence via GET
				$hide = true;
			} elseif ( isset( $_POST['tribeHideRecurrence'] ) && 1 == $_POST['tribeHideRecurrence'] ) {
				// let's HIDE recurrence events if tribeHideRecurrence via POST
				$hide = true;
			}

			/**
			 * Filters whether recurring event instances should be hidden or not.
			 *
			 * @since 4.4.29
			 *
			 * @param bool $hide
			 * @param WP_Query|null $query
			 */
			$hide = apply_filters( 'tribe_events_pro_should_hide_recurrence', $hide, $query );

			return (bool) $hide;
		}