Forums

styling last post of each row in a query (1 post)

  1. polymaze
    Member
    Posted 1 year ago #

    Hello,

    I'm trying to set up a gallery in WordPress 3.0, html5/css3 with the help of Blueprint CSS and ran into a problem with not knowing how to assign the class of "last" to the final image of each row to remove the margin/padding.

    With a post query, is it possible to set a different class for the last article of each row so that the margins and padding won't make each article too wide and pushed down to the next row?

    Or as an alternative, set every 3rd article/post with a class of "last" to remove the excess margins/padding.

    Here is an image of what I'm hoping to achieve:
    http://yfrog.com/1agridquestionj

    Uploaded with [URL=http://imageshack.us]ImageShack.us[/URL]

    And the query loop code in case it helps:

    <section id="content" class="container">
    	<?php
    		$loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => 10));
    	?>
    	<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    	<?php
    		$custom = get_post_custom($post->ID);
    		$screenshot_url = $custom["screenshot_url"][0];
    		$website_url = $custom["website_url"][0];
    	?>
    		<article class="portfolio-item">
    			<a href="#"><?php the_post_thumbnail(); ?></a>
    			<h2><?php the_title(); ?></h2>
    			<a href="<?php echo $website_url ?>">visit site</a>
    		</article><!-- .portfolio-item -->
            <?php endwhile; ?>
    	</section><!-- #content -->

    Thank you

Topic Closed

This topic has been closed to new replies.

About this Topic