Support » Plugin: Infinite-Scroll » Load next posts into wordpress Page loop

  • I’m trying to place 2 collumns with 2 different loops on one Page, then use the Infinite Scroll plugin to load the next set of posts into it’s respective container when a user clicks on a Load More Posts button.

    When loading the following loop, the pagination for itself doesn’t appear at all. Also the link selectors for the Infinite Scroll plugin don’t seem to apply either.

    Is there a problem with loading the loop within a Page, or is there an issue with the use of WP-Query?

    <div class="thirdLeft">
    				$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    				$first_query = new WP_Query('showposts=1');
    				while($first_query->have_posts()) : $first_query->the_post();
    			<div class="initialPostLoad">
    					<?php get_template_part( 'content', 'single' ); ?>
    			</div> <!-- end initialPostLoad -->
    			<?php endwhile; ?>
    			<div class="loadNextPosts">
    					// usage with max_num_pages
    					next_posts_link( 'Older Entries', $the_query->max_num_pages );
    					previous_posts_link( 'Newer Entries' );
    				<a class="loadInfinitePosts" href="#">Load More Posts</a>

    And the infinite scroll script placed in the header:

    $('.thirdLeft #articlePost').infinitescroll({
    	    navSelector  : ".loadNextPosts",
    	                   // selector for the paged navigation (it will be hidden)
    	    nextSelector : ".loadInfinitePosts a:first",
    	                   // selector for the NEXT link (to page 2)
    	    itemSelector : ".thirdLeft .initialPostLoad"
    	                   // selector for all items you'll retrieve

  • The topic ‘Load next posts into wordpress Page loop’ is closed to new replies.