[WordPress] 外掛分享: Beautiful taxonomy filters

WordPress 外掛 Beautiful taxonomy filters 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「Beautiful taxonomy filters」是 2014-11-04 上架。
  • 目前有 3000 個安裝啟用數。
  • 上一次更新是 2024-12-16,距離現在已有 137 天。
  • 外掛最低要求 WordPress 4.3.0 以上版本才可以安裝。
  • 有 68 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

jonathandejong |

外掛標籤

terms | filter | widget | taxonomy | pretty permalinks |

內容簡介

Beautiful Taxonomy Filters 是一款易於使用且外觀優美的 WordPress 外掛程式,可讓您為文章類型提供過濾功能,同時能根據自訂分類、標籤等加入過濾。此外,它還會自動新增美觀的過濾網址重寫規則,完全不需要 JavaScript,並採用WordPress Plugin boilerplate來標準化、組織和物件導向的代碼庫。在外觀上會使用select2來充分顯示下拉式選單配合使用者,當 JavaScript 不受支持時會自動切換回普通下拉式選單。
不再出現可怕的網址或 Hacky 的 JavaScript 解決辦法。
功能

啟用所有已註冊公開自訂文章類型(custom post type)的篩選。
排除您不想讓訪客過濾的分類。
美化過濾後的網址,您將不會看到任何「/posttype/?taxonomy1=term」,而是「/posttype/taxonomy/term」。美化後的 URL 更加容易讓 SEO 炫耀它們的頁面,請不要忘記在適當的位置使用canonicals。
BETA 版本:條件下拉式選單。 AJAX 重新讀取以前選擇的值,確保您的訪客永遠不會遇到空白的篩選結果。
兼容Polylang。
適用於MultiSite(多站點)。目前沒有網絡設置。
附帶完整的功能篩選模組供您將其放在主題上。
在主題中有三種選擇可使用篩選模塊:

小工具(也可以讓您在任何地方使用特定於文章的類型)
do_action hooks (細微控制)
自動置入/排列,神奇…)。

選擇不同的組件樣式,或停用樣式,並在style.css中進行自訂! 如果只是想微調樣式,則在設置頁面上直接添加自定義CSS。
有更多的設置可以進行細化篩選模块的行為:

為篩選元件提供「全部清除」的連結。
在下拉式選單中選擇佔位符或「全部顯示」。
隱藏下拉式選單中的空白詞彙。
在詞彙名稱旁顯示文章計數
禁用select2
顯示詞彙描述
禁用您不需要的標題
更多即將推出!

能夠向訪客顯示關於其當前有效篩選的信息,並控制其外觀。
允許包含自訂 GET 參數。使用自己的方式擴展篩選,例如自定義搜索參數等等。
許多可用於修改插件行為的過濾器和操作。

語言

英文
瑞典文
西班牙文(感謝Juan Javier Moreno Restituto)
荷蘭文(感謝Piet Bos)
德文(感謝Matthias Bonnes)
法文(感謝Brice Capobianco))
簡體中文(感謝Amos Lee)
葡萄牙文(感謝 Luis Martins)
葡萄牙巴西语(感谢B)

原文外掛簡介

The Beautiful Taxonomy Filters plugin is an easy and good-looking way to provide your visitors with filtering for your post types. With this you get a complete solution for adding filtering based on custom taxonomy terms/categories/tags. It will also automatically add rewrite rules for pretty looking filter URLs. It’s completely automatic, works without javascript and is based on the WordPress Plugin boilerplate for a standardized, organized and object-oriented codebase. It uses select2 for pretty looking and user friendly dropdowns but will fall back to ordinary ones if javascript is not supported.
No more horrible looking URLs or hacky Javascript solutions
Features

Activate filtering on any registered public custom post type.
Exclude taxonomies you just don’t want the visitors to filter on.
Beautifies the resulting URLs. You won’t see any /posttype/?taxonomy1=term. Instead you’ll see /posttype/taxonomy/term.
The pretty URLs are much more SEO friendly so you’ll give a boost to those filtered pages. Just remember to use canonicals where it’s appropriate.
BETA: Conditional dropdowns. Make sure your visitors never end up with empty filtered results. AJAX reloads the values in each dropdown based on previously selected values.
Polylang compatible.
Multisite compatible. No network settings at the moment.
Comes with a complete functional filter module for you to put in your theme.
Three alternatives for putting the filter modules in your theme:

Widgets (Also lets you “hard set” a post type for use anywhere)
do_action hooks (for granular control)
Automagic setting which will magically place the modules in your archive from thin air. Wizards at work…

Choose from different styles for the component, or disable styling and do it yourself in style.css! Just want to tweak a style? Add your custom CSS directly on the settings page.
Many more settings for fine-tuning the filter modules behavior:

A ”Clear all” link for the filter component.
Choose between placeholders or “show all” in the dropdowns.
Hide empty terms in the dropdowns.
Show a post count next to the term name
Disable select2
Show term description
Disable headings you don’t want
More to come!

Ability to show your visitors information about their current active filtering and control the look of this.
Allows for custom GET parameters to be included. Extend the filter your way with maybe a custom search-parameter or whatever you like.
Many filters and actions for modifying the plugins behavior. For you control freaks out there…

Languages

English
Swedish
Spanish (Thanks to Juan Javier Moreno Restituto)
Dutch (Thanks to Piet Bos)
German (Thanks to Matthias Bonnes)
French (Thanks to Brice Capobianco)
Simplified Chinese (Thanks to Amos Lee)
Portuguese (Thanks to Luis Martins)
Portuguese Brasil (Thanks to Bruno Sousa)
Catalan (Thanks to Maiol Xercavins)
Swiss (Thanks to Raphael Hüni)
Bulgarian (Thanks to Georgi Marokov)
Romanian (Thanks to Roberto Tamas)

Do you want to translate this plugin to another language? I recommend using POEdit (http://poedit.net/) or if you prefer to do it straight from the WordPress admin interface (https://wordpress.org/plugins/loco-translate/). When you’re done, send us the file(s) to [email protected] and we’ll add it to the official plugin!
Other

Based on WordPress Plugin Boilerplate
Uses Select2 to enhance dropdowns

Featured on

WP Tavern
RiverTheme
The WhiP (WPMU DEV)
TotalPhotoshop

API
**Filters**
These are the filters available to modify the behavior of the plugin. These all take at least 1 parameter which you must return
beautiful_filters_dropdown_categories
$args is an array of the arguments put into the wp_dropdown_categories function.
$taxonomy is the current taxonomy.
function modify_categories_dropdown( $args, $taxonomy ) {

return $args;
}
add_filter( 'beautiful_filters_dropdown_categories', 'modify_categories_dropdown’, 10, 2 );

beautiful_filters_post_types
$post_types is an array. Modifies the selected post types before being used.
function modify_post_types( $post_types ) {

return $post_types;
}
add_filter( 'beautiful_filters_post_types', 'modify_post_types', 10, 1 );

beautiful_filters_taxonomies
$taxonomies is an array. Modifies the excluded taxonomies before being used.
function modify_categories_dropdown( $taxonomies ) {

return $taxonomies;
}
add_filter( 'beautiful_filters_taxonomies', 'modify_categories_dropdown', 10, 1 );

beautiful_filters_taxonomy_order
$taxonomies is an array of the taxonomies slugs. $current_post_type is the post type we’re using the filter on. This must return the $taxonomies array.
function moveElement(&$array, $a, $b) {
$out = array_splice($array, $a, 1);
array_splice($array, $b, 0, $out);
}

function custom_tax_ordering($taxonomies, $current_post_type){
moveElement($taxonomies, 2, 0);
return $taxonomies;
}
add_filter('beautiful_filters_taxonomy_order', 'custom_tax_ordering');

beautiful_filters_dropdown_placeholder
$placeholder is the string used for the placeholder.
$taxonomy is the current taxonomy.
In order to change the placeholders you must use this filter rather than the modify_categories_dropdown argument “show_option_all”.
function modify_dropdown_placeholder( $placeholder, $taxonomy ) {
return 'New placeholder';
}
add_filter( 'beautiful_filters_dropdown_placeholder', 'modify_dropdown_placeholder', 10, 2 );

beautiful_filters_language
Changes the language code for the current page load.
function modify_current_language( $language ) {
return 'sv';
}
add_filter( 'beautiful_filters_language', 'modify_current_language' );

beautiful_filters_rtl
Changes wether the page is RTL or not.
function modify_current_language( $rtl ) {
return true;
}
add_filter( 'beautiful_filters_rtl', 'modify_rtl' );

beautiful_filters_disable_fuzzy
Disables select2 fuzzy search. particularly useful for terms that are all numbers.
function disable_fuzzy_search( $boolean ) {
return true;

}
add_filter('beautiful_filters_disable_fuzzy', 'disable_fuzzy_search', 10, 1);

beautiful_filters_clear_all
$bool is a boolean which decides if the ”Clear all” link should be used or not. $current_post_type is the current post type being filtered
function modify_clear_all( $bool, $current_post_type ) {

//Only add the clear all link to a specific posttype
if($current_post_type == 'movies'){
$bool = true;
}
return $bool;
}
add_filter( 'beautiful_filters_clear_all', 'modify_clear_all', 10, 2 );

beautiful_filters_hide_empty
$bool is a boolean which decides if empty terms should be displayed or not. $current_post_type is the current post type being filtered
function modify_hide_empty( $bool, $current_post_type ) {

return $bool;
}
add_filter( 'beautiful_filters_show_empty', 'modify_hide_empty', 10, 2 );

beautiful_filters_show_count
$bool is a boolean which decides if post count should be displayed or not. $current_post_type is the current post type being filtered
function modify_show_count( $bool, $current_post_type ) {

return $bool;
}
add_filter( 'beautiful_filters_show_empty', 'modify_show_count', 10, 2 );

beautiful_filters_show_description
$bool is a boolean which decides if term description should be displayed or not. $current_post_type is the current post type being filtered
function modify_show_description( $bool, $current_post_type ) {

return $bool;
}
add_filter( 'beautiful_filters_show_description', 'modify_show_description', 10, 2 );

beautiful_filters_dropdown_order
$order is a string which defaults to ASC, other possible value is DESC. $taxonomy is the current taxonomy slug
function modify_dropdown_order( $order, $taxonomy) {

return $order;
}
add_filter( 'beautiful_filters_dropdown_order', 'modify_dropdown_order', 10, 2 );

beautiful_filters_dropdown_orderby
$order is a string which defaults to NAME, other possible value is ID or SLUG. $taxonomy is the current taxonomy slug
function modify_dropdown_orderby( $orderby, $taxonomy) {

return $orderby;
}
add_filter( 'beautiful_filters_dropdown_orderby', 'modify_dropdown_orderby', 10, 2 );

beautiful_filters_dropdown_behaviour
$behaviour is a string that should be either show_all_option or show_placeholder_option. $current_post_type is the current posttype name.
Use this to modify the dropdown behaviour per posttype or just manually from functions.php
function modify_dropdown_behaviour( $behaviour, $current_post_type) {

return $orderby;
}
add_filter( 'beautiful_filters_dropdown_behaviour', 'modify_dropdown_behaviour', 10, 2 );

beautiful_filters_dropdown_behaviour
$term_name is a string that have to be returned. $category is the term object. $depth is the level of depth for the current term starting at 0 (no parent).
Use this to alter the output of the term name inside the dropdowns.
//Add visual information when a terms are children/grandchildren etc.
add_filter('beautiful_filters_term_name', 'custom_term_name', 10, 3);
function custom_term_name($term_name, $category, $depth){

//We have indentation
if($depth !== 0){
$indent = '';
//Add one – for each step down the hierarchy, like WP does in admin.
for($i = 0; $i

各版本下載點

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

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


1.2 | 1.0.1 | 1.0.2 | 1.1.0 | 1.1.1 | 1.1.2 | 1.1.3 | 1.1.4 | 1.2.1 | 1.2.2 | 1.2.3 | 1.2.4 | 1.2.5 | 1.2.6 | 1.2.7 | 1.2.8 | 1.2.9 | 1.3.0 | 2.0.0 | 2.1.0 | 2.1.1 | 2.2.0 | 2.2.1 | 2.3.0 | 2.3.1 | 2.3.2 | 2.3.3 | 2.3.4 | 2.3.5 | 2.3.6 | 2.4.0 | 2.4.1 | 2.4.2 | 2.4.3 | 2.4.4 | 2.4.5 | trunk | 1.1.4.1 | 1.1.4.2 |

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

  • nginx Compatibility 》rdPress is installed in a subdirectory, you need to adjust the path accordingly., Finally, don't forget to save your changes and restart nginx to a...。

文章
Filter
Apply Filters
Mastodon