我试图在我的wordpress博客的两个页面上插入基本分页,但分页没有出现在页面底部。我不知道我做错了什么,因为我已经看到了我正在尝试实现的完全相同的代码的许多其他示例正常工作。任何帮助将不胜感激。
两页都使用了代码
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
get_template_part( 'content-projects', get_post_format() );
endwhile;?>
<nav>
<ul class="pager">
<li><?php next_posts_link( 'Previous' ); ?></li>
<li><?php previous_posts_link( 'Next' ); ?></li>
</ul>
</nav>
<?php endif; ?>
答案 0 :(得分:0)
以下代码对我来说非常适合。也许这对你也有用。请按原样申请此代码。
<div class="nav">
<div class="alignleft numbers"><?php next_posts_link('« Older Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
</div>
添加分页的另一种方法是使用插件。Click here
通过这种方式你只需要添加短代码,如: -
<div class="nav">
<?php wp_pagenavi(); ?>
</div>