Skip Navigation

[Resolved] Searching Nested Views

This support ticket is created 6 years, 3 months 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 2 replies, has 2 voices.

Last updated by briana-5 6 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#1111753

I have created a view of posts grouped by category using this tutorial:
https://toolset.com/2015/07/how-to-group-posts-by-category/

So I have

Category 1
-Post 1
-Post 2
-Post 3

Category 2
-Post 1
-Post 2
-Post 3

Category 3
-Post 1
-Post 2
-Post 3

However, now I would like to include the ability for the user to search by categories and thus limit the posts displayed to those matching the category or categories the user has chosen. I have tried to add a search to either the parent or child view without success. Creating a search view does not work for the child view because when you create that view there is no option to filter by taxonomy of parent. Creating a parent view with a search option resulted in a list of posts by category but the search function did not do anything.

Is there a way to accomplish my goal so that I can group posts by category and then allow the user to refine that list to show, for example just Category 1?

#1112139

Hello,

The taxonomy view does not support search form, so you in your case, you can only setup the custom search form in the child post view.

In your case, it needs custom codes, for example:
1) In the child view, setup the taxonomy filter on parent taxonomy view.
2) In the child view, setup a custom search form with taxonomy filter field, when user submit the form, use filter hook wpv_filter_query to trigger a custom PHP function, and apply the taxonomy filter value to the Views query.

More help:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

#1118569

Thanks. I will try that.