Possible Duplicate:
Is it possible to add a first and latest posts link?

I'm working on an image gallery website. Here is the navigation code that appears at the bottom of each "view image" page:

<div class="previous <?php if(!get_previous_post()){ echo 'inactive'; }?>">
    <?php previous_post_link('%link'); ?>
<div class="next <?php if(!get_next_post()){ echo 'inactive'; }?>">
    <?php next_post_link('%link'); ?>

Currently, when the user is at the first post, the previous post link is inactive. I'd like to make it so that clicking the previous post link will take them to the last image. Is this possible?

marked as duplicate by fuxia Dec 24 '12 at 21:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


I solved this by using get_posts(). Credit goes to Reddit user milomilo.

Not the answer you're looking for? Browse other questions tagged or ask your own question.