如果你想有一个灰色的链接,你可以换掉posts_nav_link 对于类似的内容:
<?php if ( ! get_previous_posts_link() ) : ?>
<div class="inactive post-link post-link__previous">« Previous Posts</div>
<?php else : ?>
<div class="post-link post-link__previous"><?php previous_posts_link(); ?></span>
<?php endif; ?>
只需设置
inactive 将CSS中的类灰显。很明显,你会用
get_next_posts_link() 和
next_posts_link() 功能。
如果你想回圈,你可以尝试这样的方法,如果你的主页被设置为你的帖子页面。
<?php if ( ! get_next_posts_link() ) : ?>
<div class="inactive post-link post-link__next">
<a href="<?php echo home_url(); ?>">Next Posts</a>
</div>
<?php else : ?>
<div class="post-link post-link__next"><?php next_posts_link(); ?></span>
<?php endif; ?>
如果您的帖子页面设置为静态页面,您可以像这样获取其url
echo get_permalink( get_option(\'page_for_posts\' ) );.
希望这有帮助。