categories - 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 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:

/%category%/%postname%/

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?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745198473a4616207.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信