Description【描述】
Get extended entry info ( <!–more–> ).【獲取擴(kuò)展的文章信息(<!–more–> )】
There should not be any space after the second dash and before the word ‘more’. There can be text or space(s) after the word ‘more’, but won’t be referenced.【在第二個(gè)破折號(hào)的后面和單詞”more”的前面都不能有空格。在“more“ 的后面可以包含文字或空格,但是不會(huì)被引用。】
The returned array has ‘main’ and ‘extended’ keys. Main has the text before the <code><!–more–></code> . The ‘extended’ key has the content after the <code><!–more–></code> comment.【返回的數(shù)組包含”main“和 ”extended“這兩個(gè)值。”main“包含<code><!–more–></code> 前面的文本,”extended“包含<code><!–more–></code>評(píng)論后面的內(nèi)容】
Usage【用法】
<?php get_extended( $post_content ) ?>
Parameters【參數(shù)】
- $post_content
- (string) (required) Post content. 【(必要的)文字內(nèi)容。】
- Default: None【默認(rèn):None】
Return Values【返回的值】
- (array)
- Post before (‘main’) and after (‘extended’).
Examples【例子】
Displaying small excerpts from latest posts.【顯示最新文章的小摘要】
If you want to display the latest posts on your WordPress blog, but only the content which comes before the <!–more–> tag, you can use this:【如果你希望在你的WordPress博客中顯示最新文章,但只顯示<!–more–>標(biāo)簽前面的內(nèi)容,你可以使用下面的代碼】
<ul>
global $post;
$args = array( 'numberposts' => 5);
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post);
$content_arr = get_extended(get_the_content()); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</br>
<?php echo $content_arr['main']; //Display the part before the more tag ?>
</li>
<?php endforeach; ?>
</ul>
Note: $content_arr[‘extended’] contains the contents after the more tag.【注意:$content_arr[‘extended’] 包含more標(biāo)簽后面的內(nèi)容】
Change Log【更新記錄】
Since: 1.0.0
Source File【源文件】
get_extended() is located in wp-includes/post.php.【get_extended() 在 wp-includes/post.php 中】
參考資料:http://codex.wordpress.org/Function_Reference/get_extended





瘋了瘋了,凌亂