Skip to content

Instantly share code, notes, and snippets.

@emaildano
Created February 13, 2014 21:37
Show Gist options
  • Save emaildano/8984357 to your computer and use it in GitHub Desktop.
Save emaildano/8984357 to your computer and use it in GitHub Desktop.
Asymmetrical post query.
$args = array( 'post_type' => 'video', 'posts_per_page' => 10,);
$the_query = new WP_Query( $args );
echo '<section id="our-work">';
if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();
$counter += 1;
if ($counter == 1 || $counter == 4 || $counter == 6 || $counter == 9) {
echo '<div class="row">';
}
if($counter == 4 || $counter == 5 || $counter == 9 || $counter == 10) :
echo '<div class="span6">';
the_post_thumbnail();
echo '</div>';
else:
echo '<div class="span4">';
the_post_thumbnail();
echo '</div>';
endif;
if ($counter == 3 || $counter == 5 || $counter == 8 || $counter == 10) {
echo '</div>';
}
endwhile; endif;
echo '</section>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment