Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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>
<div class="next <?php if(!get_next_post()){ echo 'inactive'; }?>">
    <?php next_post_link('%link'); ?>
</div>

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?

share|improve this question
add comment

marked as duplicate by toscho 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.

1 Answer

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

share|improve this answer
add comment

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