Support » Plugin: WordPress Infinite Scroll - Ajax Load More » ALM Template Loading Duplicate Loops on Single Page

  • Hello!

    I’ve set up ALM on my site and have it working ‘correctly’ within the template regarding the theme and shortcode. The issue I’ve run into is that, when the page loads, it generates multiple, identical loops.

    The infinite scrolling or Load More buttons still work, so I know that the core functionality of the plugin is working. The original loop was working correctly before activating the plugin as well.

    Below is the code for the loop and the shortcode. The Repeater Template just contains the content for the generating the post excerpts. I can post a version of that if needed, but the template itself seems to be working.

    Thank you in advance for any assistance you might be able to provide or documentation I might have missed.

    Loop w/shortcode

    <?php 
        $args = array('orderby'=>'date', 'order'=>'DESC');
    
        query_posts($args);
        if ( have_posts() ) :
            
    	// Start the Loop.
            while ( have_posts() ) : the_post();
    
                	echo do_shortcode( '[ajax_load_more post_type="news_post" posts_per_page="12"]' );
    
            // Ending the general news archive loop.
            endwhile;
            
        endif;
    ?>
Viewing 1 replies (of 1 total)
  • Plugin Author dcooney

    (@dcooney)

    Hi @philmccollam,
    Totally missed this question, sorry about that.
    The issue here you have Ajax Load More inside your loop.

    ALM takes care of the loop for you. So, you could technically do the following:

    <?php 
        $args = array('orderby'=>'date', 'order'=>'DESC');
    
        query_posts($args);
        if ( have_posts() ) :
            
    	// Ajax Load More
            echo do_shortcode( '[ajax_load_more post_type="news_post" posts_per_page="12"]' );
    
            
        endif;
    ?>

    Or even just:

    <?php 
        echo do_shortcode( '[ajax_load_more post_type="news_post" posts_per_page="12"]' );
    ?>

    Hope that helps.

Viewing 1 replies (of 1 total)
  • The topic ‘ALM Template Loading Duplicate Loops on Single Page’ is closed to new replies.