the_title()
the_title( string $before = ”, string $after = ”, bool …
the_title( string $before = ”, string $after = ”, bool $echo = true )
使用可选标记显示或检索当前文章标题。
Display or retrieve the current post title with optional markup.
使用可选标记显示或检索当前文章标题。
Display or retrieve the current post title with optional markup.
目录锚点:#参数#源码#笔记
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $before | (string) | 要添加到标题前面的标记。 |
| $after | (string) | 要附加到标题的标记。 |
| $echo | (bool) | 是回显还是返回标题。echo默认为true。 |
源码(Source)
/**
* Display or retrieve the current post title with optional content.
*
* @since 0.71
*
* @param string $before Optional. Content to prepend to the title.
* @param string $after Optional. Content to append to the title.
* @param bool $echo Optional, default to true.Whether to display or return.
* @return string|void String if $echo parameter is false.
*/
function the_title( $before = '', $after = '', $echo = true ) {
$title = get_the_title();
if ( strlen($title) == 0 )
return;
$title = $before . $title . $after;
if ( $echo )
echo $title;
else
return $title;
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 0.71 | wp-includes/post-template.php | 14 | 4 |
笔记(Notes)
例子
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
还没有任何评论,赶紧来占个楼吧!