Currently I'm facing a really strange problem I can't seem to fix normally.
I've using pagination on my category pages. I've got a 'News' category with some sub categories. One sub category is 'MVO nieuws'.
When I visit '/mvo-nieuws' the pagination is working (showing an older posts link).
if ($paged) : ?>
<nav class="page-nav archive">
<?php if ($prev = get_previous_posts_link()) : ?>
<div class="alignleft">
<span class="fo icons-angle-circled-left"></span>
<span><?php previous_posts_link( 'Nieuwe berichten' ); ?></span>
</div>
<?php endif;
if ($next = next_posts($listPosts->max_num_pages, false)) : ?>
<div class="alignright">
<span>
<a href="<?= $next; ?>">Oudere berichten</a>
</span>
<span class="fo icons-angle-circled-right"></span>
</div>
<?php endif; ?>
</nav>
<?php endif; ?>
The pagination is forwarding to '/mvo-nieuws/page/2'
, but that page couldn't be found. I'll found out this is because its a subcategory of 'News', but I don't know why this seems to be a problem.
I've removed the category as a subcategory and now it's working. All my other primary categories are also working fine, but the subcategories are facing this problem.
My permalink settings are: '/%category%/%postname%/'
.
Hopefully anyone can help me out, thanks in forward!
EDIT
After Pieter Goosens his comment I thought it would be handy if you guys could see my query.
$cat = get_query_var('cat');
$category = get_category($cat);
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$listArgs = array(
'cat' => $category->term_id,
'paged' => $paged,
'posts_per_page' => 11
);
$listPosts = new WP_Query($listArgs);
while ($listPosts->have_posts()) :
$row++;
$listPosts->the_post();
endwhile;
I'll hope this can help solve my problem.