wordpress达成文章页上一篇/下一篇作用

原创
小哥 3年前 (2022-11-02) 阅读数 13 #PHP
文章标签 PHP

<?php
$categories = get_the_category();
$categoryIDS = array();
foreach ($categories as $category) {
array_push($categoryIDS, $category->term_id);
}
$categoryIDS = implode(",", $categoryIDS);
?>
<?php if (get_previous_post($categoryIDS)) { previous_post_link(上一篇: %link,%title,true);} else { echo "";} ?>


<?php if (get_next_post($categoryIDS)) { next_post_link(下一篇: %link,%title,true);} else { echo "";} ?>

版权声明

所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除