這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

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. So you can use any parameter from wp_list_categories in the 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 { ... }

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;
}

安裝

  • Upload the plugin’s directory into your wp-content/plugins/ directory.
  • Login to your WordPress Admin menu, go to Plugins, and activate it.

評價

2022年10月6日
Thank you for the great plugin! It works perfectly with WP v6.0.2 and my Hello Theme and has saved me hours of work 🙂 Cheers!
2022年10月2日
i hope these great works bless you with future work and good fortune. thank you kindly. oh and i tested this and works fine!
2016年9月3日
This plugin only working, it has no styling. I would love to have some style like grid system and two column. Thanks
閱讀全部13個評價

貢獻者及開發者

“List categories” 是一個開源的軟體。以下的人對這個外掛作出了貢獻。

貢獻者

將 List categories 外掛本地化為台灣繁體中文版。

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

修改日誌

0.4

  • Tested up to the latest version of WordPress.

0.3

  • Tested up to the latest version of WordPress
  • Adds note about taxonomies, updates parameters

0.2

  • Fixes plugin content with wrong placement. Thanks windwww from the WP Forums.

0.1