当前位置:首页 > 云计算 > 正文内容

WordPress获取文章内容函数:get_the_content

2022-05-31 08:14:34云计算7

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()

本网站文章仅供交流学习 ,不作为商用, 版权归属原作者,部分文章推送时未能及时与原作者取得联系,若来源标注错误或侵犯到您的权益烦请告知,我们将立即删除.

本文链接:https://www.xibujisuan.cn/22765.html

标签: WordPress