Support » Fixing WordPress » pagination not working for categories with wp 3.0

  • Hi,

    I’m using WP 3.0 and using this code on my archive page

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    	query_posts( array('post_type' => array( 'products' ), 'posts_per_page'=>3, 'paged'=>$paged ));
    	if (have_posts()) : while (have_posts()) : the_post();

    my pagination code working great, the first page is ok but when clicking page 2 returns error 404 page.

    in short
    this working properly
    ?cat=8

    but this not
    ?cat=8&paged=2

    It was working with 2.9!
    I’ve tried everthing i know but no chance!

    All helps are greatly appreciated
    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • Try to change the permalink first to default ?p=n, this is ugly but in my case, this works. Then I believe there’s some glitch dealing with paging if we use pretty permalink like /%category%/%postname%/.

    Then I ended up with disabling rewrite when registering custom post_type, but I still could use /%category%/%postname%/ without error on paging.

    No I’m not using permalinks, the default option is selected.

    In my case, I’ve got four post in my “blog” category. I want to list them 3 by 3. But i don’t want to change reading settings because want to list 10 by 10 in another category. When i use ‘posts_per_page’=>3 paging is not working. But if i set 1 to “Blog pages show at most” field it’s working. After all my search I believe it’s new a bug for WP 3.0!

    Hi Tolga~

    I have same problem.
    It was partially fixed by changing the admin> settings> reading > ‘blog pages show at most’ setting to 1.

    If anyone has insight on the problem, I would love to learn a better solution.

    Note: I have the default option selected as well and am using ‘posts_per_page’

    I inputted this into my functions file (courtesy of Remiz)

    //Pagination fix
    function remove_page_from_query_string($query_string)
    {
    if ($query_string['name'] == 'page' && isset($query_string['page'])) {
    unset($query_string['name']);
    // 'page' in the query_string looks like '/2', so i'm spliting it out
    list($delim, $page_index) = split('/', $query_string['page']);
    $query_string['paged'] = $page_index;
    }
    return $query_string;
    }

    good luck.

    Hi, I think I have the same problem. I’m using WP3.1.1

    My blog default amount of posts per page is 20. There is a specific category where I want only 10 posts instead of the default.

    I did a custom template for that category (category-71.php) with this code:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($query_string.'&posts_per_page=10&paged='.$paged);

    When that category got it’s 11th post, the “next posts” link showed up but when I click on it the /page/2/ calls the 404.php template.

    The second page only works when the amount of posts goes over 20 posts (the default).

    Still haven’t found a workaround it. I need the other categories to have 20 posts, not 10.

    I have the same problem too.
    Still looking for the solution..

    me 3 guys – can’t get pagination to work on categories using /%category%/%postname%/ and default posts per page at 10

    esmi

    (@esmi)

    Forum Moderator

    hey guys, the fix for me was as follows:

    • Login as the admin in WordPress.
    • Go to the Settings tab.
    • Go to the Reading tab.
    • Change the Blog pages show at most from the default 10 to any number. For example, 5.
    • Save the changes.
    • View the blog.

    from here

    abelcreative you are a geeeeenius! Worked like a treat for me!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘pagination not working for categories with wp 3.0’ is closed to new replies.