get_the_archive_title

最后更新于:2021-11-26 23:36:06

apply_filters( ‘get_the_archive_title’, string $title, string $original_title, string $prefix )

Filters the archive title.

参数

$title

(string)
Archive title to be displayed.

$original_title

(string)
Archive title without prefix.

$prefix

(string)
Archive title prefix.

源文件

文件: gc-includes/general-template.php

View on Trac

function my_theme_archive_title( $title ) {
	if ( is_category() ) {
		$title = single_cat_title( '', false );
	} elseif ( is_tag() ) {
		$title = single_tag_title( '', false );
	} elseif ( is_author() ) {
		$title = '<span class="vcard">' . get_the_author() . '</span>';
	} elseif ( is_post_type_archive() ) {
		$title = post_type_archive_title( '', false );
	} elseif ( is_tax() ) {
		$title = single_term_title( '', false );
	}
 
	return $title;
}

add_filter( 'get_the_archive_title', 'my_theme_archive_title' );