Support » Fixing WordPress » Pull The 4th, 5th, 6th Most Recent Post

  • I have 2 columns on my website – the left column pulls the 1st, 2nd, 3rd most recent posts from my WordPress Site, and the right is meant to pull the 4th, 5th, 6th most recent posts.

    I am using the following code to pull the first 3, but I can’t figure out how to just pull the 4th, 5th and 6th most recent for the right column.

    <?php while (have_posts()): the_post(); ?>
              <h2><?php the_title(); ?></h2>
              <?php the_content(); ?>
              <?php endwhile; ?>

    Would anyone be able to help me please?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Andrew Nevins

    (@anevins)

    Are you sure your 4th, 5th and 6th are publicly visible?

    They are visible. The problem is I’m using the same code for both columns at the moment so they are both pulling the same 3 most recent posts.

    Left needs: Latest Post, 2nd-Latest Post, 3rd-Latest Post
    Right needs: 4th-Latest Post, 5th-Latest Post, 6th-Latest Post

    Sorry if I’m not making much sense!

    Michael

    (@alchymyth)

    Forum Moderator

    two possibiities:

    a:
    one single loop, but with coding to close the first section after 3 posts, and opening the new section for further three posts; better for pagination;

    b:
    add a query before the loop; use a ‘posts_per_page’ parameter for both loops; use the ‘offset’ parameter in the query for the second loop;
    http://codex.wordpress.org/Class_Reference/WP_Query#Offset_Parameter

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pull The 4th, 5th, 6th Most Recent Post’ is closed to new replies.