I’m busy trying to put together a 3×3 magazine-style layout for the home page of my blog.
I want the divs containing each post to flow vertically so there aren’t big white spaces beneath each row of 3. It seems like the easiest way to do this would be to have three columns and fill each of these (which will stop there from being a big space beneath each post-block) and then place these three columns side-by-side.
The problem is that the WordPress loop needs to pull posts sequentially. I don’t know how to change the order of the WordPress loop and, even though I’ve tried some PHP trickery using counts and for loops, I can’t seem to get it to work.
Any thoughts or advice on a basic WordPress loop or CSS way to make it work would be much appreciated as it’s driving me crazy!
You can see how it is currently at http://www.unleashreality.com/
This looks like a job for jQuery Masonry.
Check it out at http://masonry.desandro.com/
The direct way using loop manipulation could be simpler assuming your layout is going to fixed one as shown in the mockup image.
Adjust the code to work with inner pages.
If you want to do this without Javascript, you’ll need to buffer the HTML for each column in your post loop and then output it in one shot once the loop is finished.
Something like the following: