Created
February 7, 2014 13:31
-
-
Save illucent/8862662 to your computer and use it in GitHub Desktop.
colums
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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; | |
| ?> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
taken from http://spruce.it/noise/good-old-2-column-loop-in-wordpres/