Support » Plugins » Multiple loops messing up Next & Prev pages

  • Hi there.
    here is a breakdown of what I am trying to do.

    On my index.php page, I am using a multiple loop to display the first post in full and the rest of the posts as excerpts.
    In all, I would like to display 3 posts on the index page, and use posts_nav_link() links to click to a next page, where I have the previous posts listed, showing only the Title & excerpts.
    The first Page looks fine. but when I click to the next page, I get the original First post, and then below that I get the 4th , 5th, 6th posts… is there a way to set this up so that the posts on the next pages are not affected by the forst loop on the index.php page?

    here is the code that is in my loops for index.php:

    <?php $my_query = new WP_Query('category_name=Uncategorized&showposts=1');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID;?>

    <div class="blog_post">
    <?php require('post.php'); ?>
    <?php comments_template(); // Get wp-comments.php template ?>
    </div><!-- end post -->

    <?php endwhile; ?>

    <?php if (have_posts()) : while (have_posts()) : the_post();
    if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>

    <div class="blog_post">
    <?php include("post2.inc"); ?>
    <?php comments_template(); // Get wp-comments.php template ?>
    </div><!-- end post -->

    <?php endwhile; endif; ?>

    <p align="center"><?php posts_nav_link() ?>

    Thanks!
    -jeremy

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Multiple loops messing up Next & Prev pages’ is closed to new replies.