The default code for “posts_nav_link” on category.php isn’t working

I am trying to make my own simple WP theme from scratch and I have run in to some difficulties. Maybe someone can help.

I have a category named “News”, whose slug is “news”.

The permalink structure in WP is set to:

So, this category is accessible through

I have made a simple template file named category.php. This is the template code:

<?php get_header(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a href=”<?php echo get_permalink(); ?>”>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php the_date(); ?>
<?php endwhile; else : ?>
<?php _e( ‘Sorry, no posts matched your criteria.’ ); ?>
<?php endif; ?>
<?php posts_nav_link( ‘ · ‘, ‘previous page’, ‘next page’ ); ?>
<?php get_footer(); ?>

I have set the default amount of posts to show per page to 5, in WP’s global “Reading settings”. When this number is exceeded, a “Next page” pagination link occurs. Okay.

Here is the problem.

This “next page” link links to:

And that URL says:
“Sorry, no posts matched your criteria”

Even though there ARE more posts in the category.

What am I missing?

Read more here:: The default code for “posts_nav_link” on category.php isn’t working

Leave a Reply

Your email address will not be published. Required fields are marked *