Tribe__Events__Community__Main::filter_document_title( array $title_parts )

Filter the document title for front end pages.


Parameters #

$title_parts

(array) (Required) The current page's title information.


Top ↑

Source #

File: src/Tribe/Main.php

		public function filter_document_title( $title_parts ) {
			global $wp;

			$current_url = home_url( $wp->request );
			// Array of front end slugs and their titles. Currently, only needed for the list.
			$slugs = [
				$this->rewriteSlugs['list'] => esc_html__( 'My Events', 'tribe-events-community' ),
			];
			foreach( $slugs as $slug => $page_title ) {
				// If the current URL begins with the slug path, let's override the title.
				$url_path = home_url( $this->getCommunityRewriteSlug() . '/' . $slug );
				if ( 0 === strpos( $current_url, $url_path ) ) {
					$title_parts['title'] = $page_title;
				}
			}

			return $title_parts;
		}

Top ↑

Changelog #

Changelog
Version Description
5.2.1 Introduced.