Skip Navigation

[Resolved] Create custom search for Archive combining Post Types

This support ticket is created 4 years, 6 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: Africa/Casablanca (GMT+01:00)

This topic contains 3 replies, has 2 voices.

Last updated by Jamal 4 years, 6 months ago.

Assisted by: Jamal.

Author
Posts
#1721687

Tell us what you are trying to do?
I want to make a View (or an Archive, that would be fine too), combining two Post Types (Posts and Cases). And I want to make a custom search/filter, where visitors can select (multiple choice) which of these Post Types they want to show. In the future, I want to expand this with extra post types (Articles). So there is one page with all the content, instead of seperate pages with separate content.

Is there any documentation that you are following?
No

Is there a similar example that we can see?
No

What is the link to your site?
hidden link

#1721747

Hello and thank you for contacting the Toolset support.

Currently, you can't filter a view by post type. But this feature will come in a near version of our plugin. We have currently a beta version, but it does not include this feature.

But, I think it can be done with some custom coding. A part of the custom code will add the post type filter control, and another part will hook into the query arguments and select which post types will be returned. Check these filters:
- https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_end_filter_form
- https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

An archive template won't work in this case, except for a special case, such as taxonomy archive, where both post types use the same taxonomy.

I hope this answers your request. Let me know if you have any questions.

#1722511

All right, I think I have to change some things. I think it's smarter to limit my Post Types and work more with taxonomies.

Then I have one Question left: Is it possible to assign a Template (and corresponding Forms) to a Taxonomy? Because when I go to a current template I can only select the 'main'-taxonomy (e.g. 'Categories') to use the template, but not a specific Category (e.g. 'Articles'), because I would like to make different templates for different categories.

In my case Articles, Blogs and Cases would be my categories for the Post Type 'Posts', but I would like to have different templates for each of the categories. Is this possible? And how do I make this happen?

#1722953

Currently, there is no way to assign a content template per taxonomy term. To work around it, you will need to create custom code, that can hook into the template assignment and change it based on the current taxonomy term. You can try with the wpv_filter_force_wordpress_archive for archive templates.
https://toolset.com/documentation/user-guides/views-filters/#wpv_filter_force_wordpress_archive