Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
single_tag_title() - 显示或检索文章标签存档的页面标题 - WordPress函数 - WordPress动力
当前浏览:首页 / WordPress函数 / single_tag_title()

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

显示或检索文章标签存档的页面标题


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 3 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "6a1059d1ab68b376b5ba76e2650231eb" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "a935db3d255e17450f4b387b9565b626" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "901a9de269b560520bcd8dd78854aca2" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

single

tagmore...

titlemore...


描述

用于在标签模板文件显示标签页面标题非常有用。前缀不会自动在前缀之间放置空格,因此如果应该有空格,则参数值需要将其放在末尾。


参数

$prefix

(string) (可选) 标题前面显示的内容,前缀。

默认值: ''

$display

(bool) (可选) 是显示还是检索标题。

默认值: true


返回

(string|void) 当检索时,返回标题。



源码

查看源码 官方文档


更新日志

版本描述
2.3.0开始引入

使用示例

  • 示例1

    此示例显示文本“Currently browsing ”,后跟标签标题。

    <p><?php single_tag_title( __( 'Currently browsing ', 'textdomain' ) ); ?></p>
    

    Currently browsing WordPress.

  • 示例2

    本例将当前标签标题分配给变量$current_tag,以便在PHP中使用。

    <?php $current_tag = single_tag_title( "", false ); ?>