get_{$adjacent}_post_sort

過濾鉤子
apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post, $order )
引數
  • (string) $order_by The `ORDER BY` clause in the SQL.
    Required:
  • (WP_Post) $post WP_Post object.
    Required:
  • (string) $order Sort order. 'DESC' for previous post, 'ASC' for next.
    Required:
定義位置
相關勾子
get_adjacent_post_joinget_adjacent_post_whereget_adjacent_post_excluded_termsadjacent_post_linkadjacent_post_rel_link
相關方法
get_adjacent_postget_adjacent_post_linkget_adjacent_post_rel_linkadjacent_post_linkwp_get_recent_postsget_attachment_icon_src
引入
4.9.0
棄用
-

get_{$adjacent}_post_sort: 此函式用於在查詢中獲取相鄰文章的排序的SQL語句。

過濾相鄰職位查詢的SQL中的ORDER BY子句。

鉤子名稱的動態部分,$adjacent,指的是相鄰關係的型別,”next”或”previous”。

可能的鉤子名稱包括:

  • get_next_post_sort
  • get_previous_post_sort
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post, $order );
$sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post, $order );
$sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1", $post, $order );

常見問題

FAQs
檢視更多 >