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.
Contents
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'.
Return
(boolean) Whether body classes should be added or not.
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; }
Changelog
Version | Description |
---|---|
5.1.4 | Introduced. |