get_the_title()获取指定/当前文章的标题

目录

描述

This function will return the title of a post for a given post ID. If the post is protected or private, the word "Protected: " or "Private: " will be prepended to the title. It can be used inside or outside of The Loop. If used outside the loop an ID must be specified.

get_the_title() 描述

用法

 <?php echo get_the_title$ID ); ?> 

get_the_title() 用法

参数

$id

(integer or object) (可选) The ID of the post or an object that specifies the post from which to get the title. By default the current post is fetched.

默认值: null

get_the_title() 参数

返回值

(string

Post title. If the post is protected or private, the word "Protected: " or "Private: " prepended to the title.

get_the_title() 返回值

历史

添加于 版本: 0.71

get_the_title() 历史

源文件

get_the_title() 函数的代码位于 wp-includes/post-template.php.

get_the_title() 源文件

相关