Problem with multiple loops
-
Hi there,
I’m trying to use the $do_not_duplicate on my single.php where I set two loops.The strange point is : sometimes, instead of displaying 3 posts as resquested with posts_per_page=3, I only got 2.
I tried to set posts_per_page=2, and sometimes, it has displayed only 1.
Does anyone know where it can come from ?
Thanks a lot for helping ??
<article class="single"> <p class="page-title">Page1</p> <?php if (have_posts()) : while (have_posts()) : the_post(); $do_not_duplicate = $post->ID; ?> <div class="post"> <div class="post-info"> <h1 class="title"><?php the_title(); ?></h1> </div> </div> <?php endwhile; ?> <?php endif; ?> </article> <section class="related"> <h2 class="title">Related</h2> <ul> <?php if(have_posts()) : ?> <?php query_posts('cat=9&showposts=3&orderby=rand'); ?> <?php while(have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?> <li> <a href="<?php the_permalink();?>"> <span class="crp_title"><?php the_title(); ?></span> </a> </li> <?php endwhile; ?> <?php endif;?> </ul> </section><!-- End of Related-->
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Problem with multiple loops’ is closed to new replies.