Posted By

rickahontas on 03/05/13


Tagged

wordpress thecontent theexcerpt


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

ashloren
rickahontas


Display latest post in full, rest in excerpt


 / Published in: PHP
 

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

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.

  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; ?>

Report this snippet  

You need to login to post a comment.