Custom Post Types, Categories and Pagination
-
Try #2 – My last post says it has been closed?
—
Hello all,
I have a site I am working on that uses custom post types extensively. I have been able to get pagination on custom post types working correctly. Unfortunately, when I go to a category page and try to go to page 2 I get a 404 error.
Any guesses?
Here’s the site (still under development): ht tp://thermosp okenhere.com/wp/ [remove spaces]
Here is a working category page: ht tp://thermospoke nhere.com/wp/category/a/
And a non-working category page: h ttp://thermosp okenhere.com/wp/category/a/page/2I’m using month/name permalink settings: htt p://thermospokenh ere.com/wp/2010/10/sample-post/
Here is the code that lists the posts on the categories page:
$catid = get_query_var('cat'); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=$catid&post_type=narrative&posts_per_page=2&paged=$paged&orderby=menu_order&order=ASC"); while (have_posts()):the_post(); ?>
And here is the code that creates the custom post type:
register_post_type( 'narrative', array( 'labels' => array( 'name' => __( 'Narratives' ), 'singular_name' => __( 'Narrative' ), 'add_new' => __( 'Add New' ), 'add_new_item' => __( 'Add New Narrative' ), 'edit' => __( 'Edit' ), 'edit_item' => __( 'Edit Narrative' ), 'new_item' => __( 'New Narrative' ), 'view' => __( 'View Narrative' ), 'view_item' => __( 'View Narrative' ), 'search_items' => __( 'Search Narratives' ), 'not_found' => __( 'No Narratives found' ), 'not_found_in_trash' => __( 'No Narratives found in Trash' ), 'parent' => __( 'Parent Narrative' ), ), 'public' => true, 'show_ui' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, //'hierarchical' => true, 'query_var' => true, 'supports' => array( 'title', 'comments' ), 'rewrite' => array( 'slug' => 'content'), 'taxonomies' => array( 'category') ) );
I have tried http://wordpress.org/extend/plugins/custom-post-type-category-pagination-fix/ but it doesn’t seem to do anything for me.
- The topic ‘Custom Post Types, Categories and Pagination’ is closed to new replies.