首页 WordPress函数 WordPress获取More标签分隔内容函数:get_extended
正文 评论

WordPress获取More标签分隔内容函数:get_extended

WordPress函数get_extended用于获取More标签分隔的内容,分别输出More标签前、后、中的内容,稍加变通就可以利用这个标签制作摘要输出、加密内容等。

get_extended( string $post_content )

函数参数

$post_content

字符串值,默认为空

传递文章内容给get_extended函数

函数返回值

Array ([main] => More标签前面的内容[extended] => More标签后面的内容[more_text] => More标签中的内容)

其中,more_text返回标签中包含的内容,例如:

<!--more这是more_text要返回的内容-->

函数使用示例

<?php$content_arr = get_extended ( $post->post_content );echo $content_arr[main];?>

扩展阅读

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

相关函数:

  • the_excerpt()
  • get_the_excerpt()
-=||=-收藏赞 (0)
更多主题
v1.0.0
小程序收录免费WordPress主题:XCX主题
¥ 0 关注:22,631
详情
单栏极简文艺WordPress博客主题:Diaspora主题
¥ 0 关注:22,133
详情
简约黑白WordPress个人博客主题:Personal主题
¥ 0 关注:21,864
详情
功能丰富切轻量的WordPress虚拟资源主题:Rizhuti主题
¥ 599 关注:19,927
详情
v1.0.0
一款简约单栏的免费WordPress博客主题:itheme主题
¥ 0 关注:19,841
详情
WordPress版WebStack导航主题:WebStack主题
¥ 0 关注:16,921
详情
回复
暂无评论

不要再留垃圾评论了,主题君整理资源不容易,留几句鼓励的话吧。