wordpress函數之get

wordpress函數之get_adjacent_post()

wordpress函數之get_adjacent_post()

get_adjacent_post():wordpress查找上一篇或者下一篇文章

用法

$post_arr=get_adjacent_post( $in_same_term, $excluded_terms, $previous, $taxonomy );
//參數
$in_same_term:(boolean)是否應該在同一個分類中。默認值:false
$excluded_terms:(數組)排除文章id。默認值為空,需要佔位
$previous:(boolean)true為上一篇,fals為下一篇。默認值:true
$taxonomy:可選,分類名稱,如果$in_same_term為true此處可寫
//返回值
成功則返回對象。
如果沒有相應的文章,則為空字符串

官方文檔:
https://codex.wordpress.org/Function_Reference/get_adjacent_post

(本文翻譯略有出入請結合官方文檔一起使用)


分享到:


相關文章: