Columns in “the Loop”

Found this code on pastebin,  to make your loop/posts float into columns and it works great! Wish I knew who to thank for it, but I can’t find it anymore. I am pretty sure it was from wordpress.org. It requires that you modify your loop in the template you need columns. I used it for the portfolio pages on my site. So glad to find it! SO  – THANKS!

 

<div id="column-wrap"><!--add this-->
 <?php
 $count = 0;

 while(have_posts()) : the_post()
 ?> 

 <div class="box<?php if( $count%3 == 0 ) { echo '-1'; }; $count++; ?>"><!-- and this-->
<a href="<?php the_permalink(); ?>">
 <h4><?php the_title(); ?></h4></a>
 <!--and other output of the loop -->
</div>
<?php endwhile; ?>
</div><!--end column-wrap-->
----------------
STYLES - EXAMPLE
.box-1 { float:left; clear:left; width: 30%; margin-left: 0; }
.box { float:left; width: 30%; margin-left: 3%; }
Posted in ,

chm