WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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

This question was marked as an exact duplicate of an existing question.

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

share|improve this answer

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