Skip Navigation

[Closed] How to query filter a view by taxonomy AND use the taxonomy as a search field

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.

This topic contains 3 replies, has 2 voices.

Last updated by Christopher Amirian 12 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2719740

Tell us what you are trying to do?
I'm trying to set up a view that is query filtered by a taxonomy "Applications > Aerospace". But i ALSO want to use the taxonomy as a custom search field dropdown that is limited to the parent category and their child categories. e.g Aerospace > Aircraft; Aerospace > Braking Systems ...

Is there any documentation that you are following?
there are few and also chat gpt but i can't get a helping answer.

I hope you may help. Thanks for your assistance and kind regards

#2720691

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

For the taxonomy default filter in the view you can use the query filter on the right sidebar of the View block settings to filter depending on the taxonomy that you have:

https://toolset.com/course-lesson/filtering-custom-lists-of-posts/

For the custom search items you can use the search section of the view to add proper search items following the steps below:

https://toolset.com/course-lesson/creating-a-custom-search/

Thanks.

#2722685
Bildschirmfoto 2024-08-19 um 08.30.37.png
Bildschirmfoto 2024-08-19 um 08.29.59.png
Bildschirmfoto 2024-08-19 um 08.26.13.png

Hi Christopher,

thanks for the information. These are things i already know. Maybe i have to clarify:
When i set the query filter to display CPTs by a taxonomy AND set a search field (dropdown) with the same taxonomy the view is no longer filtered by the previous query filter. But i need to set both and want the search field to only display the related child categories from the previous set filter. is there a way to achieve what we need?
Please see the attachment for that. As you may see the difference at the pagination.

Thanks and kind regards

#2724470

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

If I understood you correctly then it is not possible.

The issue will be that the whole view shows only custom post type entries with a specific taxonomy.

Then it does not make sense to add a front end search for the sam taxonomy as it is already selected by the view filter.

What you can do is to avoid filtering the view by default and show all taxonomies and add the front end taxonomy as a search.

it most probably will be checkboxes, then you can use Javascript to select the taxonomy in question as soon as the page loads.

That way, the filter that you want will be there and also the customer can select other taxonomies if needed.

I hope it makes sense and if needed, please implement that and get back to us with the URL and we can provide the necessary Javascript code.

Thanks.

The topic ‘[Closed] How to query filter a view by taxonomy AND use the taxonomy as a search field’ is closed to new replies.