WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I show the content in next or previous post?

For example, I use this to display the next post link with title:

   <div class="alignleftfp">
    <?php next_post_link('%link', '%title'); ?>
    <div class="alignrightfp">
    <?php previous_post_link('%link', '%title'); ?>

Is it possible to show the content of that post (100 Words)?

share|improve this question

Take a look at the get_adjacent_post function.

It takes three paramters, all of which are optional:

  • a boolean, whether the post should be from the same category
  • a string of category IDs that should be excluded
  • a boolean, whether the previous (true) or next (false) post should be retrieved.

Hence the previous post, regardless of category can be retrieved via

$prev_post = get_adjacent_post( false, '', true );

and the next via

$next_post = get_adjacent_post( false, '', false );

If successful, the function will return a complete post object, hence:

echo $prev_post->post_excerpt;

should do.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.