介绍

显示single、page页面标题,这个标签不必在the_loop循环中,只要在single、page页面即可。

使用

<?php single_post_title(); ?> 

参数

$prefix
(string) (可选) 显示在标题前的文本。
Default: None

$display
(boolean) (optional) Should the title be displayed (TRUE) or returned for use in PHP (FALSE).
Default: TRUE

示例

<?php single_post_title( 'Current post: ' ); ?>