DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

On WordPress support forum, Datadial asked how to display the full content of the most recent post, and then only posts excerpts. Let’s see how we can easily achieve this.

To achieve this, we’ll use a simple WordPress loop. The only thing we have a to add is a variable (here named $count) which will count how many posts are listed.

Here’s the code. Paste it instead your current WP loop and customize it a bit to make it fit your needs.

<?php if (have_posts()) : ?>
<?php $count = 0; ?>
<?php while (have_posts()) : the_post(); ?>
<?php $count++; ?>
  <?php if ($count < 2) : ?>
          <?php the_content() ?>
   <?php else : ?>
          <?php the_excerpt(); ?>
  <?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>

One Comment

  1. This seems to show full content for the FIRST post ever created on the blog, and not the MOST RECENT post. Am I doing something wrong?


Leave a Comment

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