Display one full post and three excerpts

October 20, 2008 · Print This Article

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

Your choice for site templates and wordpress themes


Got something to say?

You must be logged in to post a comment.