Inventory_Presser_Additional_Listings_Pages::change_page_title( mixed $post_type_name, mixed $post_type )

Callback on post_type_archive_title. Changes page titles for listings pages.


Parameters Parameters

$post_type_name

(mixed) (Required) Post type ‘name’ label.

$post_type

(mixed) (Required) Post type.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class-additional-listings-pages.php

	public function change_page_title( $post_type_name, $post_type ) {
		if ( ! class_exists( 'INVP' ) || INVP::POST_TYPE !== $post_type ) {
			return $post_type_name;
		}

		global $wp;
		foreach ( self::additional_listings_pages_array() as $additional_listing ) {
			// is this rule valid and active?
			if ( ! self::is_valid_rule( $additional_listing )
				|| ! self::is_active_rule( $additional_listing ) ) {
				continue;
			}

			// our URL path will match the beginning of the rewrite rule.
			if ( substr( $wp->matched_rule, 0, strlen( $additional_listing['url_path'] ) ) === $additional_listing['url_path']
				&& ! empty( $additional_listing['title'] ) ) {
				return $additional_listing['title'];
			}
		}
		return $post_type_name;
	}