Skip to content

Instantly share code, notes, and snippets.

@schikulski
Last active December 15, 2015 14:39
Show Gist options
  • Save schikulski/5275852 to your computer and use it in GitHub Desktop.
Save schikulski/5275852 to your computer and use it in GitHub Desktop.
Wordpress: Two column wrap
<?php while( have_posts() ) : the_post(); //start of the loop ?>
<?php if( $wp_query->current_post%2 == 0 ) echo "\n".'<div class="twocolumnpostswrap">'."\n"; ?>
<?php // do post stuff here ?>
<?php if( $wp_query->current_post%2 == 1 || $wp_query->current_post == $wp_query->post_count-1 ) echo '</div> <!--/.twocolumnpostswrap-->'."\n"; ?>
<?php endwhile; //end of the loop ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment