Support » Themes and Templates » Pagination problem: Adding extra page with no posts in there

  • pealo86


    I have set up a form on the following page that sends the values of all of its fields to a template page that creates a loop out of the values using $_GET variables. Click the link below to see the results of a search (to save you having to fill the form in):

    At first, I couldn’t get the pagination to work properly, clicking ‘next’ simply displayed no results, as if the loop did not pull any posts in.

    Suddenly I seem to have got it working (not sure what I did differently to the last time I attempted to fix it, but oh well). However there should only be two pages of results, with a maximum of two posts on each but WordPress adds a third page of results.

    There should only be 3 posts; 2 posts on one page, 1 post on the second. This is how it should be, however the 3rd (and unnecessary) page displays no posts, so I cant understand why WP is adding it??

    I have tried echoing the $paged variable and it gives me some very strange results (see on the page), they seem to be numbered ‘0, 2, 3’.

    Shouldn’t it be ‘0, 1, 2’ or ‘1, 2, 3’?? I assume the problem is somehow related to the $paged variable.

    If anybody has any advice that would be great 😀

  • The topic ‘Pagination problem: Adding extra page with no posts in there’ is closed to new replies.