I’m using the code here to try and paginate one post at a time by category but when I click on Older Posts it just fades and refreshes the current post. What am I doing wrong?
<div id="articles" class="contentbox">
<h2>Articles</h2>
<div id="posts-articles">
<?php
$new_query = new WP_Query();
$new_query->query('category_name=featurepost&showposts=1'.'&paged='.$paged);
?>
<?php while ($new_query->have_posts()) : $new_query->the_post(); ?>
<a href="<?php the_permalink() ?>"><strong><?php the_title(); ?></strong></a>
<div class="alignleft"><?php the_post_thumbnail('thumbnail'); ?></div>
<?php the_excerpt() ?>
<?php endwhile; ?>
<div id="pagination">
<?php next_posts_link('« Older Entries', $new_query->max_num_pages) ?>
<?php previous_posts_link('Newer Entries »') ?>
</div>
</div><!-- end posts-articles -->
<script>
jQuery(function($) {
$('#posts-articles').on('click', '#pagination a', function(e){
e.preventDefault();
var link = $(this).attr('href');
$('#posts-articles').fadeOut(500, function(){
$(this).load(link + ' #posts-articles', function() {
$(this).fadeIn(500);
});
});
});
});
</script>
</div>