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(); ?> <main> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <a href="<?php echo get_permalink(); ?>"> <?php the_title(); ?> </a> <?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' ); ?> </main> <?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?