Skip Navigation

[Resolved] Custom order for taxonomy fields in view filter

This thread is resolved. Here is a description of the problem and solution.

Problem:
Custom order for taxonomy fields in view filter

Solution:
There is no native way to sort terms by custom defined order using the custom field you created with taxonomy filter you added to your block view.

You may require custom code or another plugin that order the term like "Custom Taxonomy Order"

You can find the proposed solution in this case with the following reply:
=> https://toolset.com/forums/topic/custom-order-for-taxonomy-fields-in-view-filter/#post-1871467

Relevant Documentation:

This support ticket is created 4 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by franzG-4 4 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#1869259
Screenshoot.png

Tell us what you are trying to do?

I am using the block editor to build a view, showing posts and using a taxonomy filter. Toolset is offering under "field setting", a kind of field ordering based on name, slug, ..... But all this stuff is not useful for me, because I need a custom order for the taxonomy fields in the filter.

I defined a term field for this taxonomy, which is a number, hoping, that I can use the term field to sort / order the taxonomy fields. But unfortunatly, this term field does not appear in the filter field settings. Is there a way of using term fields for ordering taxonomy fields?

Is there any documentation that you are following?
Documentation on block building, but this case is not mentioned.

Is there a similar example that we can see?

What is the link to your site? ... no, I just tried and erased the contents of page ... see screenshoot of back end ....

#1869661

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I understand, you created a custom term field that holds the order of the taxonomy terms and you want to display the terms in that vary defined order with the taxonomy filter you added to your block view.

If this is correct, there is no native way to sort terms by custom defined order using the custom field you created with taxonomy filter you added to your block view.

But, fortunately, I've a workaround to share that may help you to resolve your issue but for that you will require to add bit custom code to "Custom Code" section offered by Toolset:
=> https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/

You will require to use the hook pre_get_terms that should allow you to filter the terms using the custom term field.
=> https://developer.wordpress.org/reference/hooks/pre_get_terms/

If you are not sure how to do it, please share problem URL where you added the view as well as temporary access details and I would be happy to share you the solution you are looking for.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

\I have set the next reply to private which means only you and I have access to it.

#1870623

Dear Minesh,

many thanks for your exhaustive answer. At the moment I am quite busy and I can create a full backup next weekend, so I will send you a message.

Looking around about this problem, I found the following link on Toolset's support forum

https://toolset.com/forums/topic/sorting-values-on-a-cred-from/

In this exchange, a plugin wp-term-order is mentioned by the supporter of Toolset, which should have the same effect as the custom code. Do you have any experience with this plugin? Advantages / disadvantages of this plugin vs. the custom code you are proposing?

Kind regards

Franz

#1871427

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I do not have any experience with that plugin but as shared by me, the supporter in the ticket also asked to use the 'pre_get_terms' hook.
=> https://toolset.com/forums/topic/sorting-values-on-a-cred-from/#post-1552021

so, if you want, you should try that plugin and check if that help you.

#1871467

Hi Minesh,

I tested yesterday the plugin wp-term-order. It works, but the handling is not very convenient. So I tested other plugins, some of them not working. The one, which I selected now, is

"Custom Taxonomy Order"

hidden link

which works really fine. So I would prefer for the moment to stay with this solution rather than installing the pre-get custom code, if you agree.

Many thanks for your kind support, have a good day!

Franz

#1871475

My issue is resolved now. Thank you!