• I have seen many problems with people reporting pagination problems, basically the 2nd, 3rd or 4th pages showing posts identical to the first page.

    This issue has been resolved but have not seen a solution for those using arrays.

    <?php
    $post = $wp_query->post;
    $limit = get_settings('posts_per_page');
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts(array('category__and' => array(22,24)));
    ?>

    This is the code i have in my category page, and it is showing 10 posts (by default) when i click on page 2 it shows the exact same posts as page 1. Iam using the WP Navi plugin.

    However i have another category page not using arrays since it only pulls posts from one category, but the pagination works fine, here is the code:

    <?php
    $post = $wp_query->post;
    $limit = get_settings('posts_per_page');
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('category_name=Apartment - Flat&showposts='.$limit.' paged=' . $paged);
    ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • switch to using arrays for your queries overll….its much neater…. also, you don’t include your $paged in your actual query in the top… this: paged=’ . $paged so no pagiation. Heck, you define all these variables:
    $post = $wp_query->post;
    $limit = get_settings(‘posts_per_page’);
    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    BUt call none of them in your query…..

    https://go.rvoodoo.com/paginate
    is my writeup on queries and pagination…..

    <?php query_posts( array(
          'posts_per_page' => 5,
          'cat' => '10',
          'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),
     ));
    ?>

    is my examples…but you can plug arrays into it simply…. for instance:

    <?php query_posts( array(
          'posts_per_page' => 5,
          'category__and' => array(22,24),
          'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),
     ));
    ?>

    Thread Starter drago stone

    (@drago-stone)

    hey rev voodoo

    you have saved me hours of headache

    this worked very nicely, iam in debt to you, if you need design work for anything let me know ill be happy to help out

    as you may of noticed iam not a programmer, just a designer ??

    thanks again

    Hey thanks for the offer!

    But more importantly, glad it worked!
    Once you array out the query like that, I find it is so much easier to work with!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘unsolved problems with pagination using query_posts(array’ is closed to new replies.