Pagination with query_posts (4 posts)

  1. Lasha
    Posted 5 years ago #

    I literally tried everything I could think of, and every solution the WordPress Codex gave to preserve pagination when using query_posts. Nothing worked.

    http://codex.wordpress.org/Function_Reference/query_posts#Example_3 (read Example 3 and "preserving the original query")

    A page would only show the 1st page of results, and clicking "next" or going to page/2 would throw a 404. Is this some kind of bug in 3.0.1 where the documented query preserving doesn't work?

    Crazy workaround: I used a Page with a custom template where I defined my own $wp-query with a bunch of parameters, and pagination worked beautifully.

    This workaround DOES NOT fix the original problem. Any ideas?

  2. westondeboer
    Posted 5 years ago #

    you need to have this in your query


    so in example 3 it would be:

    while(have_posts()) { the_post();
    <!-- put your loop here -->
  3. Lasha
    Posted 5 years ago #

    Is that solution tested?

    I don't see how adding that &paged=$paged would help. The "$query_string" should already have that value within it so there's no point to call &paged again...


  4. Expenses
    Posted 5 years ago #

    Yep i think the solution do work. thanks

Topic Closed

This topic has been closed to new replies.

About this Topic