Skip to content

Instantly share code, notes, and snippets.

@duard
Created January 3, 2013 06:38
Show Gist options
  • Select an option

  • Save duard/4441293 to your computer and use it in GitHub Desktop.

Select an option

Save duard/4441293 to your computer and use it in GitHub Desktop.
<div id="work">
<ul class="thumbnails">
<?php $loop = new WP_Query( array( 'post_type' => 'work', 'posts_per_page' => 9 ) ); ?>
<?php $i = 0; // starts the counter ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php if ($i % 3 == 0 ) {
echo '<li class="span4" style="clear:left;">'; // clear left if start of new row.
} else {
echo '<li class="span4">'; // continuation of a row, no need to clear left.
}
?>
<div class="post">
<div class="thumbnail">
<a href="<?php the_permalink() ?>"><div class="tint"><?php the_post_thumbnail( 'featured-thumb' ); ?></div></a>
<br />
<div class="thumbcaption">
<a href="<?php the_permalink() ?>"><h3><?php the_title() ?></h3></a>
<p> <?php the_excerpt(); ?></p>
<p><i><?php the_terms( $post->ID, 'work_project_type' , ' ' ); ?></i></p>
</div>
</div>
</div>
</li>
<?php $i++; // increments the counter ?>
<?php endwhile; ?>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment