Tribe__Tickets__Commerce__Orders_Tabbed_View::get_title( int $post_id )

Generates the title based on the page type and post ID.


Parameters

$post_id

(int) (Required) The post ID.


Top ↑

Return

(string) The generated title.


Top ↑

Source

File: src/Tribe/Commerce/Orders_Tabbed_View.php

	public function get_title( int $post_id ): string {
		/**
		 * Filters whether to show the view title.
		 *
		 * @since 5.0.1
		 *
		 * @deprecated 5.7.2
		 *
		 * @param bool 	$show_title Whether to show the view title.
		 * @param int 	$post_id The post ID.
		 */
		$show_title = apply_filters_deprecated( 'tribe_tickets_attendees_show_view_title', [ true, $post_id ], '5.6.2' );

		if ( ! $show_title ) {
			return '';
		}

		$page_type = tribe_get_request_var( 'page' );

		// List of Order pages to display the 'Orders For...' heading.
		$order_pages = [
			'tickets-orders',
			'edd-orders'
		];
		// Check $page_type to confirm if we are on Order or Attendees page.
		if ( in_array( $page_type, $order_pages ) ) {
			// Translators: %1$s: the post/event title, %2$d: the post/event ID.
			$title = _x( 'Orders for: %1$s [#%2$d]', 'orders report screen heading', 'event-tickets' );
		} else {
			// Translators: %1$s: the post/event title, %2$d: the post/event ID.
			$title = _x( 'Attendees for: %1$s [#%2$d]', 'attendees report screen heading', 'event-tickets' );
		}

		$view_title = sprintf( $title, get_the_title( $post_id ), $post_id );

		/**
		 * Filters the title on the Attendees, and Order list page.
		 *
		 * @since 5.6.2
		 *
		 * @param string 	$view_title The view title.
		 * @param int 		$post_id The post ID.
		 * @param string 	$page_type Possible values `tickets-attendees` or `tickets-orders`.
		 */
		return apply_filters( 'tec_tickets_attendees_order_view_title', $view_title, $post_id, $page_type );

	}

Top ↑

Changelog

Changelog
Version Description
5.6.2 Introduced.