Display latest post in full, rest in excerpt


/ Published in: PHP
Save to your folder(s)

To solve an issue for a blog main page in wordpress to display the latest post in its entirety and the remaining posts only the excerpt.


Copy this code and paste it in your HTML
  1. <?php if (have_posts()) : ?>
  2. <?php $count = 0; ?>
  3. <?php while (have_posts()) : the_post(); ?>
  4. <?php $count++; ?>
  5. <?php if ($count < 2) : ?>
  6. <?php the_content() ?>
  7. <?php else : ?>
  8. <?php the_excerpt(); ?>
  9. <?php endif; ?>
  10. <?php endwhile; ?>
  11. <?php endif; ?>

URL: http://www.wprecipes.com/datadial-asked-how-can-i-display-1-full-post-and-3-excerpts

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.