WordPress获取文章内容函数:get_the_content

文 / @WordPress主题

WordPress函数get_the_content用于获取文章内容,通常用在主循环The Loop中。

get_the_content( string $more_link_text = null, bool $strip_teaser = false, WP_Post|object|int $post = null )

函数参数

$more_link_text

字符串,默认值:null

当文章使用More标签分隔摘要内容时,get_the_content()函数只返回摘要内容。如果还有更多内容未能显示,将输出一个“更多”按钮,可以提供一个文本值来替换默认的更多按钮文本。

$strip_teaser

布尔值,默认值:false

当值为true,且在文章页面使用该函数时,More标签之前的摘要内容不会输出。

$post

整数或WP_Post,默认值:null

文章ID,或文章对象

扩展阅读

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

相关函数:

  • generate_postdata()
  • wp_trim_excerpt()
  • the_content_rss()
  • the_content()
  • get_the_content_feed()
添加UTHEME为好友
扫码添加UTHEME微信为好友
· 分享WordPress相关技术文章,主题上新与优惠动态早知道。
· 微信端最大WordPress社群,限时免费入群。