WordPress.org

Ready to get started?Download WordPress

Forums

Help With Pagination - search results - not refreshing content (8 posts)

  1. cultivate
    Member
    Posted 3 years ago #

    The Pagination is being added to the bottom of the search results page and the number of pages does change depending on what search term I use. But if you click the next button or select a page number the url changes but the search results don't, it just continues to display the first 10 results.

    Does anyone know how I could fix this?

    Here's my code:

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

  2. vtxyzzy
    Member
    Posted 3 years ago #

    As a guess, the query is not using the 'paged' variable. Since I can't see your code, it is hard to be specific, but it might be something like this:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    global $wp_query;
    query_posts(
       array_merge(
          $wp_query->query,
          array('paged' => $paged),
        )
    );
  3. cultivate
    Member
    Posted 3 years ago #

    I'm not sure where I should be adding what you've added...

    This is my code:

    http://pastebin.com/embed_js.php?i=VMgDrQcb

    Any Suggestions would be a BIG Help!

  4. vtxyzzy
    Member
    Posted 3 years ago #

    Add the code I posted just ahead of the 'if (have_posts())' line.

  5. cultivate
    Member
    Posted 3 years ago #

    All I'm getting is a blank page when I insert your code. Thoughts?

  6. vtxyzzy
    Member
    Posted 3 years ago #

    Please post the first 15 lines of the code with the inserted bit.

  7. michaeldante
    Member
    Posted 3 years ago #

    did pasting that code resolve the issue? I'm having the same problem where clicking on page 2 only just shows the first results again and like to know if this resolved your issue and if not what did. also, what php page did you paste the code, search.php?
    thanks

  8. vtxyzzy
    Member
    Posted 3 years ago #

    @michaeldante,

    Where you put the code depends on your theme. It must be in the template that is displaying the results that you want paginated. Determine which template is used and modify it. BACK UP FIRST!!

Topic Closed

This topic has been closed to new replies.

About this Topic