I have built a WP Loop that is limited to “2” articles that it loads. What I’d like to do is the second article in the loop or the bottom one, Not have a border-bottom on it.
How can I do this in the WP Loop?
My PHP Code is :
<div class="span content"> <!-- This is column 1 -->
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<p class=""<?php the_content(); ?>
<?php endwhile; ?>
</div><!-- /.span8 .content -->
CSS for that is :
.article {
border-bottom: 1px dotted #000000;
width: 170px;
}
Thanks
Just do it with simple CSS. Should work down to IE7.
Note: The :first-child implemtation in IE7 is a bit buggy if your first-child is a text-node like a comment.
:first-child will match Item 1
:first-child does not match Item 1 because the comment.
Workarround
or just strip the comment.
You could also count your iteration in the while-loop. Thats not an elegant Method but should work for you…
Each iteration of your WP-Loop will increment the $counter by 1.
First Iteration:
Second Iteration:
Third Iteration:
… and so on.