WordPress文章页输出文章标题标签:single_post_title

本站正在使用的主机

本站目前托管于腾讯云香港轻量服务器,价格便宜访问速度也快,使用本站推荐链接购买还可免费获得WordPress运行环境优化服务。

最新活动 »

WordPress模板标签single_post_title用于输出当前文章的标题,需要用在The Loop主循环里。

single_post_title( string $prefix = '', boolean $display = true )

函数参数

$prefix

字符串值,默认为空

在文章标题前输出的内容

$display

布尔值,默认值:true

是否输出标题,如果为false,只返回结果而不输出。

函数使用示例

以本文为例,输出:当前文章:WordPress模板标签:single_post_title

<h2><?php single_post_title( '当前文章: ' ); ?></h2>

扩展阅读

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

相关函数:

背字根微信二维码

本站文章均为原创,码字非常不容易,转载请注明原文出处,给苦逼的作者保留一点创作动力。