WordPress.org

Ready to get started?Download WordPress

Forums

Infinite scroll pagination not working for pages outside index.php (1 post)

  1. enderpal444
    Member
    Posted 2 years ago #

    Im using masonry with infinite scroll to show posts in a loop. It all works great on my index page and search page but when I place the loop on regular page or buddypress profile to show a loop of posts by author then it doesnt scroll past the "post-per-page" set for the loop. It just says no more posts to load. Here's the loop minus the guts. Any idea why this is happening?

    <div id="boxes">
    <?php
     query_posts("cat=-1&r_sortby=highest_rated&paged=".get_query_var('paged'));
       if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
       <ul>
         <li>
         </li>
        </ul>
        <?php endwhile; ?>
      <?php endif; ?>
    </div>
    <div class="infinitescroll">
    <?php next_posts_link( __( 'Load more posts', 'imbalance2' ) ); ?>
    </div>
    
    <script type="text/javascript">
     // Infinite Scroll
     var href = 'first';
     $(document).ready(function() {
    $('#boxes').infinitescroll({
        navSelector : '.infinitescroll',
        nextSelector : '.infinitescroll a',
        itemSelector : '#boxes .box',
        loadingImg : '<?php echo get_bloginfo('stylesheet_directory') ?>/images/loading.gif',
        loadingText : 'Loading...',
        donetext : 'No more pages to load.',
        debug : false
    }, function(arrayOfNewElems) {
        $('#boxes').masonry('appended', $(arrayOfNewElems));
        if (href != $('.infinitescroll a').attr('href'))
        {
            href = $('.infinitescroll a').attr('href');
        }
    });
     });
    </script>

Topic Closed

This topic has been closed to new replies.

About this Topic