Load More
// jquery.init.js
/* Ajax load more Pagination */
$('.loadmore a').on('click', function(e) {
e.preventDefault();
// $('.text_holder').append("<div class=\"loader\"> </div>");
$(this).parent().addClass('loading');
var link = jQuery(this).attr('href');
var $content = '.query-results';
var $nav_wrap = '.loadmore';
var $anchor = '.loadmore a';
var $next_href = $($anchor).attr('href'); // Get URL for the next set of posts
$.get(link+'', function(data){
var $timestamp = new Date().getTime();
var $new_content = $($content, data).wrapInner('').html(); // Grab just the content
// $('.blogPostsWrapper .loader').remove();
$next_href = $($anchor, data).attr('href'); // Get the new href
$('.query-results li:last-child').after($new_content); // Append the new content
// $('#rtz-' + $timestamp).hide().fadeIn('slow'); // Animate load
$('.loadmore a').attr('href', $next_href); // Change the next URL
//$('.team li:last').remove(); // Remove the original navigation
var nlink = $('.loadmore a').attr('href');
if(nlink == link){ $('.loadmore a').hide(1); }
}).done(function(data){
$('.loadmore.loading').removeClass('loading');
// Other scripts called after loading finishes
});
});
// before query call
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
//inside query args
<?php query_posts(array('paged' => $paged));
//link to load more
<?php next_posts_link('Load More'); ?>