get_extended WordPress Function

Description
Get extended entry info ().

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.

The returned array has ‘main’ and ‘extended’ keys. Main has the text before the . The ‘extended’ key has the content after the comment.

Usage

<?php get_extended( $post_content ) ?>

Parameters
$post_content
(string) (required) Post content.
Default: 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

<ul>
<ul><!–?php global $post; $args = array( ‘numberposts’ =&gt; 5 );&lt;br ?–> $myposts = get_posts( $args );</ul>
</ul>
&nbsp;
<ul>
<ul>foreach( $myposts as $post ) : setup_postdata( $post );</ul>
</ul>
&nbsp;
<ul>
<ul>$content_arr = get_extended ( $post-&gt;post_content ); ?&gt;
<li><!–?php the_title(); ?–>

<!–?php echo $content_arr[‘main’]; //Display the part before the more tag ?–></li>
</ul>
</ul>

tag, you can use this:

 

Note: $content_arr[‘extended’] contains the contents after the more tag.

Leave a Reply

Your email address will not be published. Required fields are marked *