the_content()

WordPress输出文章内容函数

WordPress模板函数the_content用于输出文章内容,需要用在The Loop主循环。

the_content( string $more_link_text = null, bool $strip_teaser = false )

函数参数

$more_link_text

字符串值,默认为空

当使用More函数截断内容时,提供一个字符串作为截断后显示的“阅读全文”链接的锚文本。

$strip_teaser

布尔值,但实际实用中通常传递字符串值,默认为false

提供一个字符串,会在More的锚文本后面输出,并以<span>函数包裹。

函数使用示例

输出当前文章内容并以More函数截断

the_content( sprintf(
	__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'xingkongweb' ),
	get_the_title()
) );

扩展阅读

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

相关函数:

get_the_content()
apply_filters()

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索