wordpress 上一篇、下一篇
<?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 “没有了,已经是最新文章”;} ?>