akmur
akmur

Reputation: 1635

wordpress navigation issue. previous and next posts link return blank

I have the following issue with a theme I am developing:

in my index this code

<?php previous_posts_link(); ?>
<?php next_posts_link(); ?>

returns blank results...

if instead i use

<?php previous_post_link(); ?>
<?php next_post_link(); ?>

it shows the next post (a single page). Why is that you think? Any idea? I use the above within the loop.

Upvotes: 0

Views: 1782

Answers (1)

Ian Huet
Ian Huet

Reputation: 44

On the face of it the difference is only the slightly different spelling. The actual difference is that previous_posts_link should be used outside the loop, providing a means to paginate through posts i.e. view/page/2 where page 2 can be taken into a query_posts call getting the next batch of posts.

Whereas previous_post_link/next_post_link should be used inside the loop, providing a link to previous/next post in the publish chronology.

http://codex.wordpress.org/Function_Reference/previous_posts_link

http://codex.wordpress.org/Template_Tags/previous_post_link

Upvotes: 1

Related Questions