您的当前位置:首页 > 知识博客 > wordpress建站

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

时间:2024-03-15

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


欢迎咨询/Welcome to inquire
tel/vx:18842938855
qq:1685522781
email:1685522781@qq.com

Copyright © 2019-2024 asp.cyou


Whatsapp
Powered by RRZCMS