Skip Navigation

[Resolved] Search filter for nested view of taxonomy view

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

Problem:

Is it possible to have a taxonomy view with a nested post view and to be able to search the post view by keyword?

Solution:

Yes, it is possible, but you will need to disable AJAX search/pagination feature in both parent taxonomy view and child post view.

For example:

https://toolset.com/forums/topic/search-filter-for-nested-view-of-taxonomy-view/#post-1765893

Relevant Documentation:

This support ticket is created 4 years, 11 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 darleneC 4 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#1765645

Is it possible to have a taxonomy view with a nested post view and to be able to search the post view by keyword? For example:

Category 1
- post 1
- post 2
- post 3
Category 2
- post 3
- post 4
- post 5
Category 3
- post 1
- post 6
- post 7

Some posts will be in multiple categories (post 1, post 3) and some posts will have similar content/keywords. Let's say post 1 contains the work "mask". I want a user to be able to enter "mask" in a search box and the results to display as:
Category 1
- post 1
Category 2
'No posts match your search'
Category 3
- post 1
- post 7

I apologize if this doesn't make sense.I have tried a few things such as displaying the search form and results separately but always end up with either all of the posts showing under each category or the page crashing (probably due to some sort of infinite loop).

#1765893
Only-the-search-results.JPG

Hello,

Yes, it is possible, but you will need to disable AJAX search/pagination feature in both parent taxonomy view and child post view.

For example:
1) Edit the child post view, setup the custom search form with the search box + submit button:
https://toolset.com/documentation/user-guides/views/filtering-views-for-a-specific-text-string-search/
disable AJAX search/pagination feature

2) Edit the parent taxonomy view:
- disable AJAX search/pagination feature
- in view's loop, display child post view's shortcode with option "Only the search results", see my screenshot Only-the-search-results.JPG

3) Create a page, display:-
- the custom search form of child post view with option "Only the search form", see the same screenshot Only-the-search-results.JPG
- And parent taxonomy view.

#1766171

Not sure what I was doing wrong but that worked like a charm. Thank you!