WordPress.org

Ready to get started?Download WordPress

Forums

Next_Posts_Link working on archive, not working on single?? (3 posts)

  1. KatieBen
    Member
    Posted 1 year ago #

    Heya - my next_posts_link and previous_posts_link aren't working on the single view, but ARE working on the archive view. The templates are exactly the same. Here's the code (I had to add the '1000' to get it to work on the archive view):

    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('« Older Articles', '1000') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer Articles »', '1000') ?></div>
    </div>

    I've tried disabling all plugins, checking the functions and header files for anything weird. I tried wp_reset_query before this code.

    Does anyone have ideas about how I might troubleshoot this? I've tried several different solutions found in a Google search and no dice. I think somehow I need to figure out what variable is getting messed up and where. Any ideas?

    Thanks. :)

  2. KatieBen
    Member
    Posted 1 year ago #

    Clarification: the pagination works on both the archive view and home view using the index.php template. It doesn't work on the single template.

  3. jorghe
    Member
    Posted 1 year ago #

    Hi, I've solved a problem similar to yours.
    In my case the problem was cause by the fact that the page is attached to the current url.

    So, if you are on the single page example.com/posts/post1, the function returns a link like example.com/posts/post1/page/2/
    i.e.: there is a "post1" that should not be there. I've resolved in a brutal way playing with strings functions...

Topic Closed

This topic has been closed to new replies.

About this Topic