0

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?

0

1 Answer 1

0

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.