本文最后更新于 2022-10-14,已超过 365 天未更新,内容可能已失效。
要实现说的去掉页面的 “分类:”和“标签:”,可以使用下面的代码:
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' );
来源于:https://www.wpdaxue.com/the_archive_title.html
除非注明,子佩工作室 文章均为原创,转载请以链接形式标明本文地址。




登录后即可发表评论
全部评论 (0)