Im using masonry with infinite scroll to display posts in a loop. I set the post per page which works great on the index page but when I place that same loop on a single page or a buddypress profile page then it only displays the first set of post per page and when I scroll down it returns no more posts to show. Heres the loop minus the guts.
<div id="boxes">
<?php
query_posts("cat=-1&r_sortby=highest_rated&posts_per_page=8paged=".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>
Any idea why it's behaving differently on non index pages?