Viewing 3 replies - 1 through 3 (of 3 total)
  • Your code has two loops in it, actually.

    Loop #1 (line 2 in your pastebin) skips even posts, but processes odd posts, sticking each one in a div with an id attribute of “left-column.”

    Loop #2 (lines 19 & 20) skips odd posts, but process even posts, sticking each one in a div with an id attribute of “right-column.”

    That’s why you are getting a sequence of: 1, 3, 2, 4.

    There’s more than one way to do this, but I’d suggest dropping lines 19-35, and changing the first loop to this:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    This will give you a sequence of 1, 2, 3, 4. (I’d also change the left-column id to a class, instead, but that’s me being picky.)

    Add a float:left to your left-column css, and the divs should fall into position within their parent container (news, with a width of 710px).

    Give that a try, and let us know how it works.

    Thread Starter breathelifein

    (@biellebrunner)

    I also had to change line 15 to <?php endwhile; else : ?>, cause I got an error, but yeah, that worked.
    Thanks!

    You are quite welcome. Thanks for marking the topic as resolved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Loop in 2 columns is "out of order"’ is closed to new replies.