Pagination is not working on single-{slug}.php but works fine on page-{slug}.php
I would like to have my single-{slug}.php perform a query on a list of posts from different custom post type and use pagination. The pagination appears but unfortunately, clicking the pagination does not go to that page and always remains on page 1. Currently using WP-navi, btw.
Example: Load the list of post from single-sports.php onto single-movies.php
Any advice or help would be appreciated.
Here's my single-{slug}.php:
?php
$args = array(
'post_type' = 'crew',
'paged' = ( get_query_var('paged') ? get_query_var('paged') : 1),
);
while (have_posts()) : the_post();
/* Do whatever you want to do for every page... */
?
div class="project_item"
div class="dotted"
hr /
/div
div class="project_thumb"a href="?php echo get_permalink(); ?"img src="" //a/div
div class="project_entry"h4a href="?php echo get_permalink(); ?"/a/h4
a href="?php echo get_permalink(); ?" class="readmore"Read more../a /div
/div
?php
endwhile;
?
nav
?php wp_pagenavi(array('query'=$post_query)); ?
/nav
?php
wp_reset_query(); // Restore global post data
?
Here's my functions.php:
$labels = array(
'name' = _x('Crew', 'post type general name'),
'singular_name' = _x('A crew', 'post type singular name'),
'add_new' = _x('Add A New Crew', 'crew'),
'add_new_item' = __('Add A New Creww'),
'edit_item' = __('Edit Crew'),
'new_item' = __('New Crew'),
'view_item' = __('View Crew'),
'search_items' = __('Search Cre'),
'not_found' = __('Crew Not Found'),
'not_found_in_trash' = __('Not found in trash'),
'parent_item_colon' = ''
);
$args = array(
'labels' = $labels,
'menu_position' = 6,
'public' = true,
'supports' = array('title', 'editor', 'thumbnail'),
'capability_type' = 'post',
'hierarchical' = true,
'has_archive' = true,
);
register_post_type('crew',$args);
$args = array(
'label' = 'Author Catefory',
'public' = true,
'show_ui' = true,
'hierarchical' = true
);
register_taxonomy('crew_tax','crew',$args);
Topic plugin-wp-pagenavi taxonomy categories query-posts custom-post-types Wordpress
Category Web