Home › Forums › Back End › WordPress: Multiple loops or 1 loop with multiple display options? › Re: WordPress: Multiple loops or 1 loop with multiple display options?
1) I’m not sure if this is the “right” way but I would do it like this myself too. An alternative way is to just write out 10 posts, and then depending on the post count, write out opening divs and/or closing divs (for example, after the second post, write a closing div and a new opening div for the 2-column structure), but that gets kind of confusing very early on.
So yea, I’d start with the divs, and then fill them with the appropriate posts like you did.
2) If you want all your posts to line up like that, I’m almost inclined to suggest to use tables, since it’s basically a table structure that you want. But apart from that, your approach seems fine — give everything a fixed height.
If you’d feel really adventurous you could use some jQuery to determine the highest of the three posts and then make the other two the same height. For example, the height of the title in the first column is 32px (cause it’s two lines), then the title in the second is 42px (because it has 3 lines), and then title in the third column is 16px (cause it’s one line); then make all three titles 42px and they’re lined up.
I think you’re doing it right, I would probably do it the same way.