Forums

next_posts_link() within Category Archive don't work. Category filter gets reset (1 post)

  1. sixside
    Member
    Posted 11 months ago #

    I'm trying to added paging within archive.php, more specifically for a categories view, but it should apply to all archives as well.

    It's a pretty generic Loop:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    And the paging control DO show up in the page as they should, but the links of the paging controls don't maintain the category across pages.

    So if page one of a category is: example.com/index.php/category/multimedia/

    Then page 2 should link to:
    example.com/index.php/category/multimedia/page/2/

    But instead it links to:
    example.com/index.php/page/2/

    And you can see that category is no longer a filter in that so it winds up just displaying page 2 of all posts.

    FWIW, if I manually type in the URL to the browser example.com/index.php/category/multimedia/page/2/ it works just fine and displays the second page of results in the "multimedia" category. The problem just seems to be with the next_posts_link() & previous_posts_link() functions not retaining the category value.

Reply

You must log in to post.

About this Topic