previous_post_link() and next_post_link() with a custom post type?

What I see in your code is that your next post and previous post codes are appearing within the while loop which shouldn’t be within the loop and it should appear like this:

<?php get_header(); ?>
<div class="full" >
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php endwhile; // end of the loop. ?>
<?php next_post_link('%link', 'Next post »'); ?>
<?php next_post_link('%link', 'Next post »'); ?>
</div><!--/full-->  
<?php get_footer(); ?>

Or, you can find it in detail here.

In the above post I found numeric pagination but still it have explained how exactly the pagination works, which is in great detail.

Leave a Comment