WordPress自定义文章类型归档页标题函数:post_type_archive_title

文 / @WordPress主题

WordPress函数post_type_archive_title用于在自定义文章类型归档页输出标题,通常在archive-{$post_type}.php模板中使用。

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

函数参数

$prefix

字符串

在标题前输出的内容

$display

布尔值,默认值:true

是否直接输出标题,false则只返回结果。

函数使用示例

<h1><?php post_type_archive_title(); ?></h1>

扩展阅读

post_type_archive_title()函数位于:wp-includes/general-template.php

相关函数:

  • is_post_type_archive()
  • wp_get_document_title()
  • get_the_archive_title()
添加UTHEME为好友
扫码添加UTHEME微信为好友
· 分享WordPress相关技术文章,主题上新与优惠动态早知道。
· 微信端最大WordPress社群,限时免费入群。