week_view_multiday_classes( TribeEventsProViewsV2WP_Post $event, string $day, bool $week_start_date, string $today_date )

Used in the multiday week loop.

Outputs classes for the multiday event (article).


Parameters #

$event

(TribeEventsProViewsV2WP_Post) (Required) An event post object with event-specific properties added from the the tribe_get_event function.

$day

(string) (Required) The Y-m-d date of the day currently being displayed.

$week_start_date

(bool) (Required) Whether the current grid day being rendered is the first day of the week or not.

$today_date

(string) (Required) Today's date in the Y-m-d format.


Top ↑

Return #

(TribeEventsProViewsV2array<string>) $classes The classes to add to the multiday event.


Top ↑

Source #

File: src/Tribe/Views/V2/functions/classes.php

function week_view_multiday_classes( $event, $day, $week_start_date, $today_date ) {
	$should_display = in_array( $day, $event->displays_on, true )
				  || ( ! $event->starts_this_week && $week_start_date === $day );

	$classes = [ 'tribe-events-pro-week-grid__multiday-event' ];

	if ( ! empty( $event->featured ) ) {
		$classes[] = 'tribe-events-pro-week-grid__multiday-event--featured';
	}

	// An event is considered "past" when it ends before the start of today.
	if ( $event->dates->end_display->format( 'Y-m-d' ) < $today_date ) {
		$classes[] = 'tribe-events-pro-week-grid__multiday-event--past';
	}

	if ( ! $should_display ) {
		$classes = get_post_class( $classes, $event->ID );

		return apply_filters( 'tribe_events_pro_views_v2_month_multiday_classes', $classes, $event, $day, $week_start_date, $today_date );
	}

	$classes[] = 'tribe-events-pro-week-grid__multiday-event--width-' . $event->this_week_duration;
	$classes[] = 'tribe-events-pro-week-grid__multiday-event--display';

	if ( $event->starts_this_week ) {
		$classes[] = 'tribe-events-pro-week-grid__multiday-event--start';
	}

	if ( $event->ends_this_week ) {
		$classes[] = 'tribe-events-pro-week-grid__multiday-event--end';
	}

	$classes = get_post_class( $classes, $event->ID );

	return apply_filters( 'tribe_events_pro_views_v2_month_multiday_classes', $classes, $event, $day, $week_start_date, $today_date );
}

Top ↑

Changelog #

Changelog
Version Description
5.1.1 Introduced.