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。

显示相邻的文章链接。

可以是下一个文章链接,也可以是上一个。

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
查看更多 >