[WordPress] 外掛分享: List categories

首頁外掛目錄 › List categories
WordPress 外掛 List categories 的封面圖片
5,000+
安裝啟用
★★★★
4.5/5 分(15 則評價)
2 天前
最後更新
0%
問題解決
WordPress 3.3+ v0.5 上架:2014-06-25

內容簡介

List categories 外掛可讓使用者在任何文章或頁面中透過短碼顯示分類。它提供了一個簡單的介面來使用 wp_list_categories 函數,並支援多種參數設定,方便自訂顯示的分類列表。

【主要功能】
• 使用短碼輕鬆顯示分類
• 支援自訂排序與篩選參數
• 可顯示標籤及其他 WordPress 種類
• 支援層級顯示與無限制深度
• 可自訂 CSS 樣式以調整外觀

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.5) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「List categories」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Simple plugin to display categories in any post or page with a shortcode. It’s basically a shortcode API interface to the wp_list_categories WordPress function. This means given any of the parameters accepted by the function, you can pass it in as a shortcode parameter to the categories shortcode.
Usage:
[categories orderby=count]

Will display links to all the categories and order them by number of posts in each category.
You can also list tags or any other WordPress taxonomy. You need to pass a value to the taxonomy parameter. For example to list tags: [categories taxonomy=post_tag title_li="Tags"].
By default, the usage shows:

No link to all categories
Sorts the list of Categories by the Category name in ascending order
Displayed in an unordered list style
Does not show the post count
Displays only Categories with posts
Sets the title attribute to the Category Description
Is not restricted to the child_of any Category
No feed or feed image used
Does not exclude any Category and includes all Categories
Displays the active Category with the CSS Class-Suffix ‘ current-cat’
Shows the Categories in hierarchical indented fashion
Display Category as the heading over the list
No SQL LIMIT is imposed (‘number’ => 0 is not shown above)
Displays (echos) the categories
No limit to depth
All categories.
The list is rendered using a new walker object of the the Walker_Category class

See wp_list_categories for usage.
Markup and Styling of Category Lists
Taken from the wp_list_categories official documentation.
By default, wp_list_categories() generates nested unordered lists (ul) within a single list item (li) titled “Categories”.
You can remove the outermost item and list by setting the title_li parameter to an empty string. You’ll need to wrap the output in an ordered list (ol) or unordered list yourself (see the examples above). If you don’t want list output at all, set the style parameter to none.
You can style the output with these CSS selectors :
li.categories { ... } /* outermost list item */
li.cat-item { ... }
li.cat-item-7 { ... } /* category ID #7, etc */
li.current-cat { ... }
li.current-cat-parent { ... }
ul.children { ... }

For instance, you can remove the bullet points next to each category with:
.cat-item {
list-style-type: none
}

Show categories list in columns
For outputting the list into columns, you can use CSS’s multicolumns. Since by default the list is printed as an unordered list with the “categories” class, you can add this to your CSS:
.categories{
column-count: 5;
column-gap: 50px;
}

延伸相關外掛

文章
Filter
Mastodon