Support » Fixing WordPress » Exclude posts repetition in the loop on second page

  • Hi,
    in my theme I have a custom homepage. Its loop code is this:

    <?php $temp_query = clone $wp_query; ?>
    <?php $my_query = new WP_Query('posts_per_page=3');
    	while ($my_query->have_posts()) : $my_query->the_post();
    		$do_not_duplicate[] = $post->ID;?>
    		<!-- Do stuff... -->
    		<?php comments_template(); ?>
    <?php endwhile; ?>

    This code is repeated for each group category on homepage, but in the normal loop on second page, some posts is repeated.

    The loop code for second page, and other paged, is this:

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

    You can see the results on this link: My blog

    How can I resolve?

Viewing 1 replies (of 1 total)
  • This is my code…repeating content after post.
    How can i solve this problem?

    (theme Page) for showing content of wordpress page
    <?php if(have_posts()):
    while(have_posts()): the_post(); ?>
    <h1><?php the_title();?></h1>
    <p><?php the_content();?></p>
    <?php endwhile;
    else :

    (WP Page) for showing wordpress post

    <?php query_posts(‘cat=4&showposts=8’); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php the_title()?>
    <?php the_excerpt();?>
    <?php endwhile; endif; ?>


Viewing 1 replies (of 1 total)
  • The topic ‘Exclude posts repetition in the loop on second page’ is closed to new replies.