the_title()

WordPress输出当前文章标题函数

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

the_title( string $before = '', string $after = '', boolean $echo = true )

函数参数

$before

字符串值,默认为空

在标题前输出的内容

$after

字符串值,默认为空

在标题后输出的内容

$echo

布尔值,默认值:true

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

函数使用示例

为标题添加<h2>函数并输出

<?php the_title( '<h2>', '</h2>' ); ?>

扩展阅读

the_title()函数位于:wp-includes/post-template.php

相关函数:

the_ID()
get_the_ID()
the_title_attribute()
the_title_rss()

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索