WordPress函数:next_post_link()获取下一篇文章函数

追格官方小助手/ 2022年05月31日/ WordPress/ 浏览 1190

next_post_link()是WordPress比较常用的函数之一,主要用于显示当前文章的上一篇和下一篇文章。


相关推荐:
WordPress 上一篇和下一篇功能简介
WordPress函数:给上一篇下一篇文章带缩略图展示教程


函数结构


<?php 
next_post_link( string $format = '%link &raquo;', string $link = '%title', bool $in_same_term = false, int[]|string $excluded_terms = '', string $taxonomy = 'category' )
?>


代码示例


1、去掉默认的箭头

<?php next_post_link('%link','%title');?>


2、只显示相同分类的下一篇文章

<?php next_post_link('%link','%title',true,'','category');?>


发表评论

暂无评论,抢个沙发...

客服 工单