[Gelöst] Create a Searchable View, filtered to only contain posts in specific categories
This support ticket is created vor 2 Jahre, 9 Monate. 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I need a View that outputs a grid of posts, but filtered by chosen post categories.
I want this View to contain a search function with a drop-down list (or checkboxes) for those specific categories.
I have created the View using Toolset Blocks.
Under the "Content Selection" > Query Filter , I've applied a filter on the taxonomy to only show the categories I need.
But - when I add a Search for the categories (either a drop-down, or a check-box format) it loses the Query filter - the search displays all category names, and the View output loop shows posts from ALL categories.
It feels like I am missing something really obvious!
Thank you for contacting us and I'd be happy to assist.
Your observation is correct and this is the expected behavior. If a static query filter for a taxonomy is added through "Content Selection > Query Filter", it will be overridden by the dynamic query applied by the front-end search field for that same taxonomy.
To achieve what you're planning, you'll need to take care of two things:
1. You can hide the unwanted category term options from the front-end filter using custom CSS code, so that the user can't select them.
( it would be simpler if you use the select/drop-down type filter )
I had assumed that once I had set the Query filter to control the content of the View, the search drop-downs from the category would inherit those settings and only display the options specified in the filter.
(That would be a really useful option, no? )
I think I'll just scrap the idea of including the search and go for buttons hardcoded to category archives instead.
I've performed some further tests and can confirm that the static query filter is not added with the dynamic front-end search filters, but the dynamic one overrides the static one.