Could someone please link to the solution to this issue?
I’ve been searching the forums for a while now and almost every thread ends with a link to search the forums which leads to results which end with links to search the forums…
I realize this is a common request, but right now I’m stuck in an infinite forum search loop looking for the common answer.
There are probably many ways to do this, but this is how I would do it.
Outside the loop, set a PHP variable like this:
$is_first_post = 1;
Then, in a div wrapping your post block, I’d have something like this:
<div class="post <? if ($is_first_post) { echo "first_post"; } ?>">
Finally, at the bottom of the loop (but still inside!), a statement like this:
$is_first_post = 0;
That would add the “first_post” class to the div on the first loop through (since the variable is set as 1 (you could use ‘true’, too)), but then after the loop cycles once the variable is set to 0 and never evaluates as true again.
HTH
Thanks, jbiesnecker. I put something together based on your advice combined with information from this thread:
http://ww.wp.xz.cn/support/topic/97946
Set a variable to start counting at the start of the loop:
<?php while (have_posts()) : the_post();?>
<?php $postvariable++; /* count the posts */ ?>
Make a conditional check within the loop:
<!-- If first post, show full contents. If not first, show excerpt -->
<?php if ($postvariable == 1)
the_content();
else
the_excerpt(); ?>
This seems to be working for me, but any further advice or refinements would be appreciated.