Linux 软件免费装
Banner图

Custom Taxonomy Order

开发者 mpol
更新时间 2024年11月28日 01:58
PHP版本: 7.0 及以上
WordPress版本: 6.7
版权: GPLv2 or later

标签

order category order taxonomy order term order

下载

4.0.2 3.2.1 3.4.0 3.4.1 4.0.1 3.4.3 3.0.0 3.0.1 3.1.0 3.2.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.2 3.4.4 3.2.2 4.0.0

详情介绍:

Custom Taxonomy Order is a plugin for WordPress which allows for the ordering of taxonomy terms. It supports the following features: Compatibility This plugin is compatible with ClassicPress. Contributions This plugin is also available in Codeberg.

安装:

  1. Upload the plugin folder to the /wp-content/plugins/ directory
  2. 通过 WordPress 的“插件”菜单激活插件
  3. Order terms in the admin menu under Tools > Term Order
  4. Optionally set whether or not to have queries of the selected taxonomy be sorted by this order automatically.
  5. Optionally set 'orderby' => 'term_order', 'order' => 'ASC' to manually sort queries by this order.
  6. Enjoy!
Upgrade Notice If you update from the original Custom Taxonomy Order please deactivate that first, then activate this plugin. Removal of database changes First you can disable the plugin. Then in wp_options you can delete the field:

常见问题:

I sorted the terms in the WordPress backend, but I don't see it changed in the frontend

Did you set the option for that taxonomy to use that custom order? Make sure to check it so the filters run with your taxonomy.

How do I sort the terms when using a custom query?

When you use default functions like get_terms or get_categories, this should not be needed. If you do need to, you can apply the sorting for the taxonomy by using: 'orderby' => 'term_order'.

I use get_term_children but the terms do not get sorted

This function only fetches the ID's of the terms, so it is impossible to sort them by term_order. If you do need the sort_order, use a function like get_terms with the 'child_of' parameter. That will fetch an array of WP_Term objects that can be sorted.

I have a custom taxonomy that uses the Tag Cloud functionality, but it doesn't sort like it should.

If it is a much used plugin, can you tell me what is the name for the taxonomy? In the customtaxorder_wp_get_object_terms_order_filter it needs to be added, and the get_terms filter should not run on that taxonomy. The tag_cloud_sort filter should do that. If it is a custom taxonomy, you can also use a filter:

I'm using the_tags function, but it doesn't sort as it should.

There is a bug with the the_tags function, where it will sort according to the setting for categories. This happens in the 'customtaxorder_apply_order_filter' function where the $args has two taxonomies but only one orderby can be returned.

I use WooCommerce Attributes and Categories.

This plugin only supports sorting the attributes/terms. These are the items like S, M and L. For sorting the taxonomies like 'size', you need to sort them on Woo's attributes page. For Products Categories, you can change the order on Product > Categories. There’s a three-line icon next to each category, you can hold it and drag the category up or down to change the order.

What capabilities are needed?

For sorting the terms you need the manage_categories capability.

Can I sort the taxonomies themselves?

There is an admin page to sort them, and save them in the database. You can use a function to sort taxonomies themselves like this: name . ""; } ?> The function requires a parameter with an array of taxonomy objects.

Can I hook into saving the term order on the dashboard page?

'customtaxorder_update_order' is being run when saving the order of terms in the admin page. You could add the following example to your functions.php and work from there.

Can I hook into changing the term order on the frontend?

'customtaxorder_terms_ordered' action is being run after term array has been ordered with usort. Please be aware that this can be triggered multiple times during a request. You could add the following example to your functions.php and work from there.

Can I hook into the settings for each taxonomy to change the sorting behaviour?

'customtaxorder_settings' filter is being after fetching the settings for all taxonomies. You could add the following example to your functions.php and work from there.

I use the GET parameter 'orderby' to order posts, but then it is ignoring term order

In case the GET parameter 'orderby' is set it will be used to order terms, instead of posts, users, or anything else. Therefore when that GET parameter is set, there is no custom order applied in this plugin. You can add a filter to possible ignore the orderby parameter in the GET request. That might be useful if your GET parameter for orderby is used to sort posts, users, or just anything that is not terms. Example code for using the filter:

How can I add my own translation?

Translations can be added very easily through GlotPress. You can start translating strings there for your locale. They need to be validated though, so if there's no validator yet, and you want to apply for being validator, please post it on the support forum. I will make a request on make/polyglots to have you added as validator for this plugin/locale.

更新日志:

4.0.2 4.0.1 4.0.0 3.4.4 3.4.3 3.4.2 3.4.1 3.4.0 3.3.3 3.3.2 3.3.1 3.3.0 3.2.2 3.2.1 3.2.0 3.1.0 3.0.1 3.0.0 2.10.0 2.9.5 2.9.4 2.9.3 2.9.2 2.9.1 2.9.0 2.8.3 2.8.2 2.8.1 2.8.0 2.7.8 2.7.7 2.7.6 2.7.5 2.7.4 2.7.3 2.7.2 2.7.1 2.7.0 2.6.6 2.6.5 2.6.4 2.6.3 2.6.2 2.6.1 2.6.0 2.5.9 2.5.8 2.5.7 2.5.6 2.5.5 2.5.4 2.5.3 2.5.2 2.5.1 2.5.0 2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 2.3.9 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.3 2.2 2.1 2.0 1.0