post_type_archive_title

Advertisement

Summery Summery

Display or retrieve title for a post type archive.

Syntax Syntax

post_type_archive_title( string $prefix = '', bool $display = true )

Description Description

This is optimized for archive.php and archive-{$post_type}.php template files for displaying the title of the post type.

Parameters Parameters

$prefix

(Optional) What to display before the title.

Default value: ''

$display

(Optional) Whether to display or retrieve title.

Default value: true

Return Return

(string|void) Title when retrieving, null when displaying or failure.

Source Source

File: wp-includes/general-template.php

	}

	$prefix = '';
	if ( ! empty( $title ) ) {
		$prefix = " $sep ";
	}

	/**
	 * Filters the parts of the page title.
	 *
	 * @since 4.0.0
	 *
	 * @param string[] $title_array Array of parts of the page title.
	 */
	$title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) );

	// Determines position of the separator and direction of the breadcrumb.
	if ( 'right' === $seplocation ) { // Separator on right, so reverse the order.
		$title_array = array_reverse( $title_array );
		$title       = implode( " $sep ", $title_array ) . $prefix;
	} else {
		$title = $prefix . implode( " $sep ", $title_array );
	}

	/**
	 * Filters the text of the page title.
	 *
	 * @since 2.0.0

Advertisement

Changelog Changelog

Changelog
Version Description
3.1.0 Introduced.

Advertisement

Leave a Reply