Paginating List Of Posts on Category Page
-
Hi,
I already have pagination running on a custom loop on my website homepage but can not get it to work for lists of posts in a custom loop in a custom category.php template file.
I am using the following code:
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $my_latest_post = new wp_query( array( 'post_type' => 'post', 'category_name' => $my_category, 'posts_per_page' => 8, 'paged' => $paged ) ); while ( $my_latest_post->have_posts() ) : $my_latest_post->the_post(); . . . endwhile; ?> <div class="nav-previous alignright"><?php next_posts_link( 'Older Products' ); ?></div> <div class="nav-next alignleft"><?php previous_posts_link( 'Newer Products' ); ?></div>
The previous and next post links never display – there is no nav hyperlink present in the browser. The loop itself works fine and I can manipulate all parameters correctly, its just the nav links after it are not displaying.
Any help much appreciated.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Paginating List Of Posts on Category Page’ is closed to new replies.