I have a series of pages for individual products. I'd like to page between them using a navigation that sits outside of the loop.

               |              |
( <= prev )    |    <loop>    |    ( next => )
               |              |

I've tried posts_nav_link. I've tried is_paged conditionals within the loop. I've tried everything I can think of.

Anyone know how to accomplish this without hacking the hell out of WP?

  • Can you please update your answer with your code, not whole of it but your loop and the navigation snippets. May 22, 2011 at 5:16
  • Can you elaborate on what exactly is not working with both posts_nav_link and is_paged?
    – Lea Cohen
    May 22, 2011 at 5:42
  • the same problem here, after page 10, I get 404 error in page navigation after upgrading to WP 3.4 wp-pagenavi does not work anymore :(
    – Mario
    Jun 16, 2012 at 0:58

2 Answers 2


I use previous_post_link() and next_post_link() (Codex previous_post_link()/next_post_link()) outside of the Loop, with no problems.

Note that the Codex entries indicate that these functions must be used within the Loop, but IMX that isn't true. The functions call the $post global, and pass it to get_previous_post() and get_next_post(), respectively.

By the way, posts_nav_link() is the incorrect function to use in the single-post context, anyway. It is intended for navigation of archive index pages, not of single posts.


Not entirely clear on the question. But If it's navigation OUTSIDE the loop that you want. Then get wp-pagenavi and set it up however you want (prev/next only, or numbered navigation) and then simply call the following in the footer OR anywhere in the template files you want the navigation to show.

<?php wp_pagenavi(); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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