Pagination on category pages not working
-
I have set up a site with pages assigned to individual categories. The code I have in my category.php template displays all of the posts (using a custom post type) in the selected category, but when I insert the code needed to get the pagination to work, it displays all posts, regardless of category. I’m somewhat of a WordPress (and PHP) novice, and am likely missing something about how the code works.
Here’s what I have currently:
<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'category' ) ); ?> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts( array('post_type' => 'lesson', 'category_name' => $term->slug, 'paged' => $paged));?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> // loop here <?php endwhile; ?> <?php toolbox_content_nav( 'nav-below' ); ?> <?php endif; ?> <?php wp_reset_query(); ?>
I’m using the Toolbox theme, which has built-in content navigation menus. I’ve also tried using wp_pagenavi code to no avail, so I think it’s a problem with how I’m using query_posts.
Any help would be appreciated. Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Pagination on category pages not working’ is closed to new replies.