Tribe__Events__Pro__Shortcodes__Register::body_classes_should_add( boolean $add, array $add_classes, array $existing_classes, string $queue )

Hook into filter and add our logic for adding body classes.


Parameters

$add

(boolean) (Required) Whether to add classes or not.

$add_classes

(array) (Required) The array of body class names to add.

$existing_classes

(array) (Required) An array of existing body class names from WP.

$queue

(string) (Required) The queue we want to get 'admin', 'display', 'all'.


Top ↑

Return

(boolean) Whether body classes should be added or not.


Top ↑

Source

File: src/Tribe/Shortcodes/Register.php

	public function body_classes_should_add( $add, $add_classes, $existing_classes, $queue ) {
		global $post;

		// If we're doing the tribe_events shortcode, add classes.
		if (
			is_singular()
			&& $post instanceof \WP_Post
		) {
			foreach ( $this->shortcodes as $shortcode ) {
				if ( has_shortcode( $post->post_content, $shortcode ) ) {
					return true;
				}
			}
		}

		return $add;
	}

Top ↑

Changelog

Changelog
Version Description
5.1.4 Introduced.