Skip Navigation

[Closed] Use query filter taxonomy AND custom filter search taxonomy (childs)

This support ticket is created 3 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 3 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1991541

Hello,

Sorry for my english. On my site, I have courses that is classified into category and subcategory (taxonomy).
I have created a view and would like to use this same view in several pages of the site by filtering the results on some category.

It works, but I would like to display in these pages also a manual filter or the visitor could refine the filter with the subcategories. But when I use the filter query via the shortcodes, I no longer have the option to use the category field taxonomy in the search form, it is grayed out.

How can I automatically filter a view on a category (via shorcode) AND display a custom filter field in the page where the user can choose the subcategories?

Thanks for your help

#1991795

Hello,

You can add one filter on same taxonomy in the custom search form.

In your case, you might consider custom codes, for example:
1) Setup the view block and custom search form normally:
https://toolset.com/course-lesson/creating-a-custom-search/

2) Use filter hook wpv_filter_query to customize view's query as what you want in different pages:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

#1991907

Thank you for your response.
It might be a stupid question, but where should I put hook wpv_filter_query, where exactly?

#1991973

You can follow our document to create a code snippet, and put the your custom PHP codes into it:
https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/

#1996501

I tried to follow the different instructions, but it doesn't work. I can't.

Say I have categories (taxonomy) like this:

• Cat01
o CAT01-A
o CAT01-B
o CAT01-C
• Cat02
o CAT02-A
o CAT02-B
o CAT02-C
• Cat03
o CAT03-A
o CAT03-B
o CAT03-C

I create a view (vue1) with a filter on the categories (taxonomy)

Then I create a page "Page cat 01" and I put my view (vue1) in it.

I do not understand what I should put or or so that in my page "Page cat 01", I want see all the data which are in the category "Cat01" and all its children (cat01-A, cat01-B, cat01- C) I would like my search filter to offer me only the subcategories of cat01 (cat01-A, cat01-B, cat01-C)

#1996969

Since it needs custom codes, please provide a test site with the same problem, also point out the problem page URL and view URL, I need to test and debug it in a live website, thanks

The topic ‘[Closed] Use query filter taxonomy AND custom filter search taxonomy (childs)’ is closed to new replies.