Loop add .last class to last item in loop

admin

Administrator
Staff member
Im using wordpress and using the following to get the last 3 most recent posts:

Code:
    <?php query_posts('showposts='.$latest_num.'&cat=-'.$featured_cat.','.$latest_ignore.''); ?>
    <?php while (have_posts()) : the_post(); ?>
    <li>
        <div class="imgholder">
            <a href="/wp-content/themes/twentyten/images/slide1.jpg" data-gal="prettyPhoto[featured]" title="<?php the_title(); ?>">
                <img src="<?php echo get_post_meta($post->ID, 'thumbnail',true) ?>" width="275" height="145" alt="Post Image" class="postimg-s" />
            </a>
        </div>
        <h4><?php the_title(); ?></h4>
        <p><?php the_content('Read more...'); ?></p>
    </li>
    <?php endwhile; ?>

What I want to do is add a class named
Code:
'last'
to the
Code:
<li>
element on the 3rd interation through the loop.

Anyone got any ideas how I could add this?