Hi!
Does anyone know how I according to this tutorial I can have -- not two -- but four side-by-side columns in WordPress?
Thanks!
Hi!
Does anyone know how I according to this tutorial I can have -- not two -- but four side-by-side columns in WordPress?
Thanks!
That tutorial is about as easy as it gets.
Yes, but the part where you can have four columns instead of two isn't explained here.
Someone who knows how this is done?
try and replace this line:
<?php if ($col == 1) echo "</div>"; (($col==1) ? $col=2 : $col=1); endwhile; ?>
(which, imho, is wrong anyway and should read:
<?php if ($col == 2) echo "</div>"; (($col==1) ? $col=2 : $col=1); endwhile; ?> )
with this line:
<?php if ($col == 4) { echo "</div>"; $col=0; }; $col++; endwhile; ?>
it puts the end div after the fourth column, then resets the counter.
untested, hope it works for you ;-)
edit: a comment on this http://www.cre8d-design.com/2008/03/how-to-organize-posts-into-two-side-by-side-columns-in-wordpress/
pointing to a weakness of the presented code: it does not close the 'row' div for an uneven number of posts.
fix:
instead of:
<?php if ($col == 4) { echo "</div>"; $col=0; }; $col++; endwhile; ?>
try this:
<?php if ($col == 4) { echo "</div>"; $col=0; }; $col++; endwhile;
if ( $col > 1 ) { echo "</div>"; } ; ?>
untested
This topic has been closed to new replies.