Support » Plugin: WordPress Infinite Scroll - Ajax Load More » Returning Duplicate Items at the beginning and end of the loop

  • Resolved dexter_ade


    Hello, I have the problem the custom post type called “issues” are duplicated the 2 most recent posts at the beginning and end of the loop of my page, this happens when I add order = “ASC” in the shortcode.

    My code:

    <div class="right">
              $the_query = new WP_Query( array(
                'posts_per_page' => 15,
                'post_type' => 'issues'
              ) );
            <div class="grid issues thumbs mtxs">
              <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                <div class="issue">
                  <a href="{{ get_the_permalink() }}">
                    <figure class="lazy-container">
                        src="{{ the_post_thumbnail_url('thumbnail') }}"
                        data-src="{{ the_post_thumbnail_url('large') }}"
                        alt="{{ get_the_post_thumbnail_caption() }}"
                    <p class="issue-number mb0"><?= get_field('number'); ?></p>
                    <p class="issue-title mt0">{{ the_title() }}</p>
              <?php endwhile; ?>
            <?= do_shortcode('[ajax_load_more offset="15" post_type="issues" container_type="div" css_classes="grid issues thumbs" transition_container="false" pause="true" posts_per_page="15" scroll="false" transition="none" order="ASC" button_label="Load More"]'); ?> 

    This are two firsts recent posts and this last

    Test with Version 5.0.0 and Version 5.0.1

    How I solve this?
    Thank you for you help.

    • This topic was modified 3 months ago by  dexter_ade.
    • This topic was modified 3 months ago by  dexter_ade.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author dcooney


    Hi @dexter_ade

    If you are using your own query before ALM you need to use the offset parameter to offset the post load.

    Also you will want to use wp_reset_query() before you load ALM to reset any global bats in the loop.

    Hope this helps.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.