
內容簡介
此外掛擴充了預設分類機能,將其擴展至使用者,同時自動化所有樣板代碼。
啟用後,可使用以下程式碼註冊使用者分類:
register_taxonomy('profession', 'user', array(
'public' =>true,
'single_value' => false,
'show_admin_column' => true,
'labels' =>array(
'name' =>'Professions',
'singular_name' =>'Profession',
'menu_name' =>'Professions',
'search_items' =>'Search Professions',
'popular_items' =>'Popular Professions',
'all_items' =>'All Professions',
'edit_item' =>'Edit Profession',
'update_item' =>'Update Profession',
'add_new_item' =>'Add New Profession',
'new_item_name' =>'New Profession Name',
'separate_items_with_commas'=>'Separate professions with commas',
'add_or_remove_items' =>'Add or remove professions',
'choose_from_most_used' =>'Choose from the most popular professions',
),
'rewrite' =>array(
'with_front' =>true,
'slug' =>'author/profession',
),
'capabilities' => array(
'manage_terms' =>'edit_users',
'edit_terms' =>'edit_users',
'delete_terms' =>'edit_users',
'assign_terms' =>'read',
),
));
在 codex 中進一步閱讀有關註冊分類的資訊。
此掛件深受以前由 Justin Tadlock 的工作和 Damian Gostomskis 插件的啟發。透過這個插件可以新增額外的功能,包括:
修復在使用者編輯畫面中顯示現有使用者分類的錯誤
修復在舊有插件中使用者計數的錯誤,刪除使用者時沒有更新計數
支援 ‘single_value’ 屬性時使用的使用者分類,此分類應僅有一個值。
註冊分類時正確支援與分類相關的功能
支援 ‘show_admin_column’ 屬性來註冊分類,以相同方式支援文章分類。
在 ‘show_admin_column’ 為 true 時,管理員可以透過批次編輯功能分配使用者分類
查詢更多有關如何註冊使用者分類的資訊,請參閱我們的文件。
您喜歡這個插件嗎?請考慮留下5星評論 。
喜歡這個插件或想要協助 LocalHero Project 嗎?請考慮捐款。
外掛標籤
開發者團隊
原文外掛簡介
This plugin extends the default taxonomy functionality and extends it to users, while automating all the boilerplate code.
Once activated, you can register user taxonomies using the following code:
register_taxonomy('profession', 'user', array(
'public' =>true,
'single_value' => false,
'show_admin_column' => true,
'labels' =>array(
'name' =>'Professions',
'singular_name' =>'Profession',
'menu_name' =>'Professions',
'search_items' =>'Search Professions',
'popular_items' =>'Popular Professions',
'all_items' =>'All Professions',
'edit_item' =>'Edit Profession',
'update_item' =>'Update Profession',
'add_new_item' =>'Add New Profession',
'new_item_name' =>'New Profession Name',
'separate_items_with_commas'=>'Separate professions with commas',
'add_or_remove_items' =>'Add or remove professions',
'choose_from_most_used' =>'Choose from the most popular professions',
),
'rewrite' =>array(
'with_front' =>true,
'slug' =>'author/profession',
),
'capabilities' => array(
'manage_terms' =>'edit_users',
'edit_terms' =>'edit_users',
'delete_terms' =>'edit_users',
'assign_terms' =>'read',
),
));
Read more about registering taxonomies in the codex
This is heavily inspired by previous work by Justin Tadlock and also forks Damian Gostomskis plugin in the repository to add additional functionality, including:
Fixes a bug with display of existing user taxonomies in the user-edit screen
Fixes a bug with taxonomy count in the old plugin where deleting users did not update the count
Add support for ‘single_value’ attribute when registering a user taxonomy for taxonomies which should only have one value.
Properly supports the capabilities associated with the taxonomy when registered.
Supports ‘show_admin_column’ attribute when registering the taxonomy in the same way as post taxonomies.
Where ‘show_admin_column’ is true admins can assign user taxonomies using bulk edit functionality.
Check out our documentation for more information on how to register user taxonomies.
Like this plugin? Please consider leaving a 5-star review.
Love this plugin or want to help the LocalHero Project? Please consider making a donation.
