Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get extended

This page is marked as incomplete. You can help Codex by expanding it.


Get extended entry info (<!--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.

The returned array has 'main' and 'extended' keys. Main has the text before the <!--more-->. The 'extended' key has the content after the <!--more--> comment.


<?php get_extended$post_content ?>


(string) (required) Post content.
Default: None

Return Values

Post before ('main') and after ('extended').


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:

global $post;
$args = array( 'numberposts' => 5 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata( $post );  
    $content_arr = get_extended ( $post->post_content ); ?>
       <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
       <?php echo $content_arr['main']; //Display the part before the more tag  ?>   
<?php endforeach; ?>

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


Change Log

Since: 1.0.0

Source File

get_extended() is located in wp-includes/post.php.


See also index of Function Reference and index of Template Tags.