wordpress loop, applying something new every third post

nullhack

New Member
I have this loop which basically displays a block on the page with an image in it, the class \[code\]gallerypic\[/code\] has a margin of 20px on the right, it also has the rule \[code\]float:left;\[/code\], the issue is every time the third div is created it starts on a new line, because the margin is pushing it there. So Ideally every third post I would like no margin, and to apply a div \[code\]gallerypicright\[/code\] or something.Im wondering does someone have a solution to this? Possibly an easier one that simply stops the margin from happening when its the third one? I need the margin on the other two as it creates a neat gap between the posts.\[code\]<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $archive_query = new WP_Query('cat=14&showposts=14&paged=' . $paged); $id = get_the_ID();while ($archive_query->have_posts()) : $archive_query->the_post(); ?> <div class="events"> <div class="gallerypic"><div class="limerickguideblockheader"><p><a href="http://stackoverflow.com/questions/12743708/<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?> </div> <div class="gallerypiccontainer"><a href="http://stackoverflow.com/questions/12743708/<?php the_permalink(); ?>" > <?php echo get_the_post_thumbnail( $id, 'gallery-thumb', $attr ); ?> </a></div> </div> </div> <?php endwhile; ?>\[/code\]edit: a picture paints a 1000 words, here is the link so far, with three posts...http://limerickfc.hailstormcommerce.com/cms/?page_id=2466A method via CSS would be even better if possible.CheersAdrian
 
Back
Top