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.

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?

share|improve this question
    
Can you please update your answer with your code, not whole of it but your loop and the navigation snippets. –  Hameedullah Khan May 22 '11 at 5:16
    
Can you elaborate on what exactly is not working with both posts_nav_link and is_paged? –  Lea Cohen May 22 '11 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 M Jun 16 '12 at 0:58
add comment

2 Answers

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.

share|improve this answer
add comment

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(); ?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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