JeremyEnglert / JointsWP-CSS

A blank WordPress theme built with Foundation 6, giving you all the power and flexibility you need to build complex, mobile friendly websites without having to start from scratch.
http://jointswp.com
75 stars 23 forks source link

Pagination issues with category postname permalink structure #16

Closed NielsPilon closed 8 years ago

NielsPilon commented 8 years ago

Not really sure if this is JointsWP related but think it is.

I'm running into an issue with the pagination after setting up my permalink structure as %category%\%postname%. This breaks the default pagination when using the category.php template as it returns a 404.

Managed to solved this with a custom query

`<?php // set up or arguments for our custom query $paged = ( get_query_var('page') ) ? get_query_var('page') : 1; $query_args = array( 'post_type' => 'post', 'category_name' => 'nen-2767-kennisbank', 'posts_per_page' => 5, 'paged' => $paged ); // create a new instance of WP_Query $the_query = new WP_Query( $query_args ); ?>

<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); // run the loop ?>

<?php get_template_part( 'parts/loop', 'archive' ); ?>

<?php endwhile; ?>

<?php if ($the_query->max_num_pages > 1) { // check if the max number of pages is greater than 1 ?>

<?php joints_page_navi(); ?>

<?php } ?> <?php else : ?>`

And using a plugin https://wordpress.org/plugins/category-pagination-fix/

Now the 404 issues are solved but the pagination is not listing the correct page as active. It always shows '1' as active page but you can navigate when clicking the pagination numbers and 'next' / 'prev' links.

Could this be caused with the custom pagination that JointsWP uses?

NielsPilon commented 8 years ago

Update: nothing wrong with the build in theme pagination. I got it wrong myself...

hassanrazmy commented 5 years ago

Just want to add that make sure you do not have the slug of the template you are using the loop on similar to any of the post types exist in the theme. If a page slug is similar to the post type slug, the pagination will not work properly.