I’m using this to pull out the four most popular posts based on comments:
<?php
$pc = new WP_Query('orderby=comment_count&posts_per_page=4'); ?>
<?php while ($pc->have_posts()) : $pc->the_post(); ?>
<div class="popular-post-item">
<span class="popular-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="post-links"><?php the_title(); ?></a></span>
<span class="popular-author">by: <?php the_author() ?></span>
<a href="<?php the_permalink(); ?>" class="action">Read Full Article</a>
</div>
<?php endwhile; ?>
What I need is the fourth:
<div class="popular-post-item">
to have another class added called .last
any ideas?
use $pc->post_count to get the number of posts returned by WP_Query and compare it to iterator.