Forums

Exclude posts repetition in the loop on second page (1 post)

  1. Satiro
    Member
    Posted 3 months ago #

    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?

Reply

You must log in to post.

About this Topic