Skip to content

Instantly share code, notes, and snippets.

@illucent
Created February 7, 2014 13:31
Show Gist options
  • Select an option

  • Save illucent/8862662 to your computer and use it in GitHub Desktop.

Select an option

Save illucent/8862662 to your computer and use it in GitHub Desktop.
colums
<?php
query_posts('YOUR QUERY HERE');
$i = 0;
// Thanks to PaoloVIP for the suggestion to add round() for loops with an odd # of results
if ( have_posts() ) : while ( have_posts() ) : the_post();
if ($i == 0) echo '<div id="left">';
if ($i == (round($wp_query->post_count / 2))) echo '</div><div id="right">';
the_content(); // or whatever custom content you desire
if ($i == round($wp_query->post_count)) echo '</div>';
$i++;
endwhile; endif;
?>
@illucent

illucent commented Feb 7, 2014

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment