Support » Themes and Templates » Next and Previous Permalinks Everywhere

  • I currently have a WP site which shows one post at a time. To go between the posts, I have “previous” and “next” links. Currently, the navigation code looks like so:

    <li id="previousLink"><?php posts_nav_link('','','&laquo; previous') ?><?php previous_post('%','&laquo; previous', 'no'); ?></li>
    <li id="permaLink"><a href="<?php the_permalink(); ?>">perma-link</a></li>
    <li id="nextLink"><?php posts_nav_link('','next &raquo;','') ?><?php next_post('%','next &raquo;', 'no'); ?></li>

    So, when the user goes to the front page and clicks “previous” etc, they get the link supplied by posts_nav_link() (which is a relative link). When they’re using the perma-linked page, they get the next_post() and previous_post() links (which are permalinks).

    However, I’d like the next and previous post links to always be permalinks so that no matter which post someone is looking at, the address in the top is always a permalink to that post (except for the front page, of course). How might I achieve this? I’ve searched high and low here and in the codex and I still haven’t quite found out a way to force the “single page” behavior.

Viewing 1 replies (of 1 total)
  • Annnnddd… Bump! I’m hoping someone has an answer to this.

    Is there a way to do this or will I have to write a some custom PHP code to grab the post id of the “first” post that the user is currently viewing and then create a url from there?

Viewing 1 replies (of 1 total)
  • The topic ‘Next and Previous Permalinks Everywhere’ is closed to new replies.