adjacent_post_link

函式
adjacent_post_link ( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' )
引數
  • (string) $format Link anchor format.
    Required:
  • (string) $link Link permalink format.
    Required:
  • (bool) $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
    Required:
    Default: false
  • (int[]|string) $excluded_terms Optional. Array or comma-separated list of excluded category IDs. Default empty.
    Required:
    Default: (empty)
  • (bool) $previous Optional. Whether to display link to previous or next post. Default true.
    Required:
    Default: true
  • (string) $taxonomy Optional. Taxonomy, if $in_same_term is true. Default 'category'.
    Required:
    Default: 'category'
定義位置
相關方法
get_adjacent_post_linkadjacent_posts_rel_linkget_adjacent_post_rel_linkadjacent_image_linkedit_post_link
引入
2.5.0
棄用
-

adjacent_post_link: 這個函式用於生成一個給定類別中下一個或上一個文章的連結。它需要三個引數。$format, $link, 和 $in_same_cat。

顯示相鄰的文章連結。

可以是下一個文章連結,也可以是上一個。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
echo get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy );
}
function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) { echo get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy ); }
function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
	echo get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy );
}

常見問題

FAQs
檢視更多 >