[WordPress] 外掛分享: Parentless Categories

WordPress 外掛 Parentless Categories 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Parentless Categories」是 2009-06-11 上架。
  • 目前有 10 個安裝啟用數。
  • 上一次更新是 2025-04-21,距離現在已有 12 天。
  • 外掛最低要求 WordPress 4.6 以上版本才可以安裝。
  • 尚未有人給過這款外掛評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

coffee2code |

外掛標籤

list | category | categories | coffee2code | the_category |

內容簡介

這個外掛提供了一個模板標籤,作為 WordPress 內建模板標籤the_category()的修改版本。 the_category()列出了直接指定給帖子的所有類別。 c2c_parentless_categories()則列出這些類別,排除父類別中有其他指定類別的類別。

例如,假設你的類別結構是層次化的,看起來像這樣:

Vegetables
|-- Leafy
| |-- Broccoli
| |-- Bok Choy
| |-- Celery
|-- Fruiting
| |-- Bell Pepper
| |-- Cucumber
| |-- Pumpkin
|-- Podded
| |-- Chickpea
| |-- Lentil
| |-- Soybean

如果你直接將類別「Fruiting」、「Cucumber」和「Pumpkin」指定給帖子,c2c_parentless_categories()會返回一個列表,該列表包含:「Cucumber」和「Pumpkin」。請注意,由於「Fruiting」是直接分配給其他類別的父類別,因此它不包含在列表中。

默認情況下,類別以 HTML 列表形式顯示。首個引數允許你定義自定義分隔符,例如:要顯示簡單的逗號分隔類別列表,可以使用:

與通過the_category()列出的類別一樣,列出的類別以鏈接的形式呈現到各自的類別存檔頁面中。

範例用法(基於上面的範例):

輸出類似於:

輸出類似於:

Cucumber, Pumpkin

鏈接: 外掛首頁 | 外掛目錄頁面 | GitHub | 作者首頁

開發人員文檔

開發人員文檔可以在 DEVELOPER-DOCS.md 中找到。該文檔涵蓋了外掛所提供的模板標籤和鉤子。

總的來說,這些是外掛提供的模板標籤:

c2c_parentless_categories():輸出無父類別的類別。
c2c_get_parentless_categories_list():返回無父類別的類別列表。
c2c_get_parentless_categories():返回指定帖子的無父類別的類別列表。

這些是外掛提供的鉤子:

c2c_parentless_categories(動作),c2c_get_parentless_categories_list,c2c_get_parentless_categories(過濾器):
允許以另一種方式安全地調用每個同名函數,以便如果禁用或刪除插件,則對函數的調用不會導致失敗。

原文外掛簡介

This plugin provides a template tag which acts as a modified version of WordPress’s built-in template tag, the_category(). the_category() lists all categories directly assigned to the specified post. c2c_parentless_categories() lists those categories, except for categories that are parents to other assigned categories.
For example, assume your category structure is hierarchical and looks like this:
Vegetables
|-- Leafy
| |-- Broccoli
| |-- Bok Choy
| |-- Celery
|-- Fruiting
| |-- Bell Pepper
| |-- Cucumber
| |-- Pumpkin
|-- Podded
| |-- Chickpea
| |-- Lentil
| |-- Soybean

If you directly assigned the categories “Fruiting”, “Cucumber”, and “Pumpkin” to a post, c2c_parentless_categories() would return a list that consists of: “Cucumber”, and “Pumpkin”. Notice that since “Fruiting” was a parent to a directly assigned category, it is not included in the list.
By default, categories are listed as an HTML list. The first argument to the template tag allows you to define a custom separator, e.g. to have a simple comma-separated list of categories: .
As with categories listed via the_category(), categories that are listed are presented as links to the respective category’s archive page.
Example usage (based on preceding example):

Outputs something like:

Outputs something like:
Cucumber, Pumpkin

Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
Developer Documentation
Developer documentation can be found in DEVELOPER-DOCS.md. That documentation covers the template tags and hooks provided by the plugin.
As an overview, these are the template tags provided by the plugin:

c2c_parentless_categories() : Outputs the parentless categories.
c2c_get_parentless_categories_list() : Returns the list of parentless categories.
c2c_get_parentless_categories() : Returns the list of parentless categories for the specified post.

These are the hooks provided by the plugin:

c2c_parentless_categories (action), c2c_get_parentless_categories_list, c2c_get_parentless_categories (filters) :
Allows for an alternative approach to safely invoke each of the identically named functions in such a way that if the plugin were deactivated or deleted, then your calls to the functions won’t cause errors on your site.
c2c_parentless_categories_list (filter) :
Customizes the return value of the c2c_parentless_categories_list() function.
c2c_get_parentless_categories_omit_ancestors (filter) :
Customizes the function argument indicating if ancestor categories of all directly assigned categories (even if directly assigned themselves) should be omitted from the return list of categories.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Parentless Categories」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0 | 1.1 | 2.0 | 2.1 | 2.2 | 2.3 | 1.1.1 | 1.1.2 | 1.1.3 | 1.1.4 | 1.1.5 | 2.0.1 | 2.0.2 | 2.0.3 | 2.0.4 | 2.0.5 | 2.1.1 | 2.1.2 | 2.1.3 | 2.1.4 | 2.1.5 | 2.2.1 | 2.3.1 | trunk |

延伸相關外掛(你可能也想知道)

  • FileBird – WordPress Media Library Folders & File Manager 》Media Folder 是史上最佳的 WordPress 外掛,可讓您使用資料夾對媒體庫進行分類。, 我們可以使用拖放式組織方式整理 WordPress 媒體庫資料夾。, 試用 | 升級...。
  • Pages with category and tag 》在頁面中新增分類和標籤。。
  • WordPress Tag, Category, and Taxonomy Manager – AI Autotagger 》axoPress allows you to show a customizable display of the terms assigned to the current post. You can choose which taxonomy and which format to dis...。
  • Search & Filter 》Search & Filter 是一款簡單的 WordPress 搜尋和篩選外掛程式,是 WordPress 搜尋框的進階版。, 您可以透過類別、標籤、自訂分類、文章類型、發佈日期或...。
  • Remove Category URL 》這個外掛可以徹底將 WordPress 網站的連結結構中的「/category/」去除(例如:從 mydomain.com/category/my-category/ 變成 mydomain.com/my-category/ )。,...。
  • Category Posts Widget 》Category Posts Widget是一個輕巧的小工具,設計用於一件事並且做得很好:顯示特定類別中最新的文章。, 基於詞語和類別的文章小工具, 這個免費小工具的高級版...。
  • Media Library Categories 》此外掛可允許在 WordPress 媒體庫中使用分類。啟用後,媒體庫中會顯示下拉式的分類清單。, 您可以使用大量動作進行多項目的分類更改、新增或移除分類。, 在使...。
  • Add Category to Pages 》「Add Category to Pages」外掛讓你能夠快速新增 WordPress 頁面的分類和標籤。, 這個外掛能夠為 WordPress 頁面加上 WordPress 分類的功能。, 啟用外掛後,...。
  • WP No Base Permalink 》該外掛能夠將分類基礎從您的分類永久連結中移除 (可選)。默認情況下啟用。, 該外掛能夠從您的分類永久連結中移除父級分類 (可選)。, 該外掛能夠將標籤基礎從...。
  • Advance WordPress Search Plugin 》WooCommerce Advance Product Search是WooCommerce最快的搜尋外掛程式,支援AJAX搜尋和搜尋結果頁面顯示。, TH Advance Product Search是一個強大的基於AJAX...。
  • Term Management Tools 》請注意,此外掛需要至少 PHP 7.1。, 如果您需要重新組織標籤和分類,此外掛可以讓您更輕鬆地進行操作。它在條目管理頁面的“批次操作”下拉菜單中添加了三個新...。
  • Taxonomy Images 》在你的主題中顯示圖像, 有一些過濾器可以在你的主題中使用,來顯示此外掛創建的圖像關聯。請閱讀以下詳細信息。, 顯示代表術語檔案庫的單個圖像, 以下過濾器...。
  • PS Taxonomy Expander 》PS Taxonomy Expander 可以讓您更輕鬆地在編輯文章時使用類別、標籤和自訂分類法。, 功能, , 啟用將分類法核取方塊變成有階層的單選按鈕功能。, 讓您在 WordP...。
  • Parent Category Toggler 》當選擇子目錄時,自動切換到父目錄。, 1.3.4, , 相容更新 WordPress 4.8。, , 1.3.3, , 測試過 WP 4.4。, , 1.3.2, , 只在 wp-admin 的文章 (也包括自訂文章...。
  • List Custom Taxonomy Widget 》清單自訂分類小工具是一種快速且簡單的方式,可以顯示自訂分類。只需從自動填充的清單中選擇要顯示的分類名稱即可。您還可以設置小工具要顯示的標題。可以將...。

文章
Filter
Mastodon