post_type_archive_title

Definition:
function post_type_archive_title( $prefix = '', $display = true ) {}

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

Parameters

  • string $prefix: Optional. What to display before the title.
  • bool $display: Optional, default is true. Whether to display or retrieve title.

Return values

returns:Title when retrieving, null when displaying or failure.

Defined filters

  • post_type_archive_title
    apply_filters('post_type_archive_title', $post_type_obj->labels->name )

Source code

function post_type_archive_title( $prefix = '', $display = true ) {

	if ( ! is_post_type_archive() )

		return;



	$post_type_obj = get_queried_object();

	$title = apply_filters('post_type_archive_title', $post_type_obj->labels->name );



	if ( $display )

		echo $prefix . $title;

	else

		return $title;

}

10128

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: