Previous/Next posts links stop working while using multiple loops
-
I am using three loops in my index. This goes well and they all seem to work on first sight.
// /////start of loop code//////////////////////////
//first loop makes 2 excerpts!
<?php query_posts(‘showposts=2’);
if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class=”post”>
<h2 id=”post”><?php the_title(); ?></h2>
<div class=”entry”>
<?php the_excerpt() ?>
</div>
</div>
<?php endwhile; endif; ?>//second loop list the 10 most recent posts
<h2>Last 10 Posts</h2>
<?php query_posts(‘showposts=10’); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
[<?php the_time(‘d-m’) ?>]</td><td><?php the_time(‘H:i’) ?></td><td><?php the_title() ?> (<?php comments_aantal();?>)
<?php endwhile; endif; ?>//third loop shows the 10 articles
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class=”post”>
<h2 id=”post”><?php the_title(); ?></h2>
<small><?php _e(“Written by”); ?> <?php the_author() ?> in <?php the_category(‘,’) ?> — <?php the_time(‘l j F Y’) ?> <?php the_time(‘G:i’) ?> <?php edit_post_link(__(‘[edit]’)); ?></small>
<div class=”entry”>
<?php the_content(‘More.. »’); ?>
</div>
<?php comments_popup_link(‘No reactions »’, ‘1 reaction »’, ‘% reactions »’); ?>
</div>
<?php endwhile; ?>// ////////end of loop code///////////////////////////
Everything is showed as i want is (on http://www.x-ite.nl), however when clicking on ‘Vorige berichten’ (Previous posts) at the bottom of my page I’m going to http://www.x-ite.nl/page/2/.
The problem is that over there the same posts are shown, instead of the 10 previous posts!The code I used to link to previous posts is:
// ////////start of previous post code/////////////////
<div class=”navigation”>
<div class=”alignleft”><?php posts_nav_link(”,”,’« Vorige berichten’) ?></div>
<div class=”alignright”><?php posts_nav_link(”,’Volgende berichten »’,”) ?></div>
</div>
// ////////end of previous post code///////////////////What do I need to change so that I can fix the problem of showing the same posts (on what should be different pages)?
I already read http://codex.ww.wp.xz.cn/The_Loop#Multiple_Loops but as they say over there, query_posts should be used (as I already do..)I’m using the theme Kubrick-nl 1.5 and WP 2.0.2.
When i remove the first 2 loops, the previous post links work fine.
The topic ‘Previous/Next posts links stop working while using multiple loops’ is closed to new replies.