Nested custom post type pagination
-
Hi forum,
after spending almost a day on this problem I hope that you can help me.
I have a custom post type “employee”. In a wp_query I want to display all entries and want to have them paginated as well. That all works – on a regular page it does at least.However if I insert the same code on my “single-institution.php” (institution is a custom post type as well that ) the pagination does not work anymore. It shows up, it links to the “correct” page (page/2/) but the link always leads back to the first page. It seems the following pages are not generated at all.
So is this possible at all? Can I have a working pagination for a custom post type on a “single-custom post type page”?
This is what the query code looks like:
$args=array( 'post_type' => "employee", 'post_status' => 'publish', 'caller_get_posts' => 1, 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => 3, 'paged' => $paged ); $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query($args); // then I loop through the query previous_posts_link('« Newer') ; next_posts_link('Older »'); wp_pagenavi(); //wp_reset_query(); // Restore global post data stomped by the_post(). // Reset the query $wp_query = null; $wp_query = $temp;
The argument array of the “institution” post type lools like this – in case this could be relevant:
$args = array( 'label' => __('Institution'), 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, '_builtin' => false, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array("slug" => "in"), 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => true, 'menu_position' => 20, 'supports' => $supports );
All help is appreciated!
Robin
- The topic ‘Nested custom post type pagination’ is closed to new replies.