
內容簡介
介紹了 [list-pages]、[sibling-pages] 和 [child-pages] 短碼,方便在文章中顯示頁面清單。這兩個短碼可以接受您傳遞給 wp_list_pages() 函數的所有參數,此外還添加了一個 class 參數。
使用範例
按標題排序頁面清單
[list-pages sort_column="post_title"]
列出頁面但排除某些 ID,並將清單的 class 設置為「my-page-list」
[list-pages exclude="17,38" class="my-page-list"]
顯示文章摘要(對於不存在摘要支援的頁面,需要手動添加或通過 Page Excerpt 外掛程式添加)
[list-pages excerpt="1"]
列出當前頁面的子項,但僅顯示頂層
[child-pages depth="1"]
列出當前頁面的同級頁面及其子頁面
[sibling-pages depth="2"]
預設引數
預設值與 wp_list_pages() 函數相同,除了 title_li 預設為空。如果沒有指定 class,UL 標籤會自動分配一個預設的 class,分別為「list-pages」、「sibling-pages」或「child-pages」。此外,echo 參數沒有效果。
除了 wp_list_pages() 的參數外,您還可以指定:
list_type(字串)清單標籤,預設為 <ul>。
exclude_current_page(整數)排除當前頁面。預設為 0。
excerpt(整數)顯示頁面摘要。預設為 0。
外掛標籤
開發者團隊
原文外掛簡介
Introduces the [list-pages], [sibling-pages] and [child-pages] shortcodes for easily displaying a list of pages within a post or page. Both shortcodes accept all parameters that you can pass to the wp_list_pages() function with the addition of a class parameter.
Example Usage
List pages sorted by title
[list-pages sort_column="post_title"]
List pages but exclude certain IDs and set the class of the list to “my-page-list”
[list-pages exclude="17,38" class="my-page-list"]
Show excerpt (for pages excerpt support will need adding manually or via the Page Excerpt plugin)
[list-pages excerpt="1"]
List the current page’s children, but only show the top level
[child-pages depth="1"]
List the current page’s siblings and their subpages
[sibling-pages depth="2"]
Default Arguments
The default values are the same as for the wp_list_pages() function except for title_li which defaults to nothing. If a class is not specified, a default class of either “list-pages”, “sibling-pages” or “child-pages” is given to the UL tag. In addition, the echo parameter has no effect.
In addition to the wp_list_pages() arguments, you can also specify:
list_type (string) List tag. Defaults to
- .
exclude_current_page (int) Exclude the current page. Defaults to 0.
excerpt (int) Show the page excerpt. Defaults to 0.
