Is it possible to change the html output for every third post in a wordpress loop?
Like, I want t have 2 posts with 50% width, then 1 with 100% width, then 2 x 50% again etc.
here is my current loop:
<?php
$args = array(
'post_type' => 'posts'
);
$the_query = new WP_Query( $args );
?>
<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<article class="large-12 columns">
<?php
if(has_post_thumbnail()) {
the_post_thumbnail('mycustomsize');
} else {
echo '<img src="'.get_bloginfo("template_url").'/img/placeholder.jpg" />';
}
?>
<h1><?php the_title(); ?></h1>
<p><?php the_field('main-content'); ?></p>
</article>
<?php endwhile; endif; wp_reset_query(); ?>
And this one gives all posts the same html output obviously. The only part I want to change is so that every third post the article element gets the class medium-12 instead of medium-6.
Can this be done?