Category Page – Pagination Error
-
Hello and good day to everyone.
I’m having a problem with the pagination function for my category page. Every time I click on the [Next Page] button (with the url “https://www.site.com/blog/main-category/sub-category/page/2/”), it leads me to a [page not found] page (with the url “https://www.site.com/blog/main-category/sample-page/”).
Here’s the code that I am currently using…
<?php get_header(); ?> <div class="head_content_wrapper"> <h2 class="cat_name <?php the_title(); ?>"> <?php $categories = get_categories(); foreach($categories as $category) { if($category->parent == 0 ){ echo '<a id="head_content_link" href="' . get_category_link($category) .'">' . $category->name . '</a>'; } } ?> </h2> </div> <section id="primary" class="site-content"> <div id="content" role="main"> <?php if ( have_posts() ) : query_posts( array( 'posts_per_page' => 3, 'paged'=> $paged )); /* Start the Loop */ while ( have_posts() ) : the_post(); get_template_part( 'content', get_post_format() ); endwhile; endif; ?> <!-- Pagination --> <table width="100%" border="0" cellspacing="3" cellpadding="3"> <tr> <td align="left"><?php previous_posts_link('? Previous Page') ?></td> <td align="right"><?php next_posts_link('Next Page ?','') ?></td> </tr> </table> <!--end Pagination--> </div><!-- #content --> </section><!-- #primary --> <?php get_sidebar(); ?> <?php get_footer(); ?>
Any help would be greatly appreciated. Thanks.
Edit: I’ve tried changing the [Setting > Reading > Blog pages show at most] to 3 and 2 and 1, and it still doesn’t solve my problem. :/
- The topic ‘Category Page – Pagination Error’ is closed to new replies.