• I have a custom post type called Questions on my website and I’m using the new 3.1 feature to have an index page to show all the posts which is at this url: domain.com/qna/

    However the paging doesn’t seem to work. When I go to domain.com/qna/page/2/ I just get a 404. Is this a bug with 3.1 or does paging not work with archives?

Viewing 9 replies - 1 through 9 (of 9 total)
  • I have tested all my CPT’s using new archive feature on 3.1

    Some have custom queries, some do not. All paginate properly

    Flush your permalinks by visiting your settings->permalinks page and hitting save

    (I believe just visiting the page does it, but hitting save doesn’t hurt)

    See if that helps

    Thread Starter driz

    (@driz)

    Tried that several times and still not getting anywhere :/

    I have even tried adding the following in the template archive-questions.php to see if I can force the paging:
    <?php global $query_string; query_posts( $query_string . 'orderby=date&posts_per_page=10&post_type=questions&paged=' . get_query_var( 'page' ) ); ?>

    But still I get a 404 :/

    Moderator keesiemeijer

    (@keesiemeijer)

    Try it with this:

    <?php
        if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
        elseif ( get_query_var('page') ) { $paged = get_query_var('page');
        } else { $paged = 1; }
    ?>
    <?php global $query_string; query_posts( $query_string . 'orderby=date&posts_per_page=10&post_type=questions&paged=' . $paged); ?>
    Thread Starter driz

    (@driz)

    Still get the 404 🙁 tried flushing the permalinks again after adding your code but still get a 404!

    Here is archive-questions.php in full: http://pastebin.com/6ZPLz975

    Do you see any problems? Thanks.

    Moderator keesiemeijer

    (@keesiemeijer)

    Can we see how you registered your post type (register_post_type) in functions.php.
    if you have something like this in it:
    'rewrite' => array( 'slug' => 'questions', 'with_front' => true ),
    try and change it to:
    'rewrite' => array( 'slug' => 'question', 'with_front' => true ),
    and see if that helps

    Try quering without the query string:

    <?php
        if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
        elseif ( get_query_var('page') ) { $paged = get_query_var('page');
        } else { $paged = 1; }
    ?>
    <?php query_posts('orderby=date&posts_per_page=10&post_type=questions&paged=' . $paged); ?>

    Thread Starter driz

    (@driz)

    Here: http://pastebin.com/WZyGcju6

    I’ve tried it with and without the query_posts but the pagination still does not work

    Thread Starter driz

    (@driz)

    any updates? thanks

    Same here… No luck whatever I do.

    It seems like a bug to me because I and many others cannot get this to work on a custom post type archive.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Does Paging work on Custom Post Type Archives?’ is closed to new replies.