Hi there,
Thanks for writing back.
Minesh is on a personal day-off today and I'll be following up on this ticket.
>> My idea was: using several content types for my site. Every content type uses the same taxonomie.
>> In this way the user has the option to search through all the content types only belongs to one category.
- Whether you'll use the originally planned approach of hierarchical taxonomy or the suggested approach of post-relationship, the search between the multiple content or post types will work the same way.
In your search's post view, you'll select the post type for example "Posts" that you'd like to get the results from, in either case.
( ref: https://toolset.com/documentation/user-guides/front-page-filters/ )
However, the use of multiple post type will complicate this. Can you add all your posts which need to be included in the search in a same post type? To differentiate/segregate them, you can assign a custom taxonomy, as a workaround.
If you decide to use a single post type for this search, here is an overview of how this will need to be set up:
1. Suppose you'd like to include the "Posts" post type in your search.
2. To develop a conditional and multi-level search filter, you'll register two new custom post types:
a). Heads
b). Subs
3. As the name indicates, you'll add all "head" items as individual posts in the "Heads" post type and all the "sub" items as posts in "Subs" post type.
4. To make a connection between these two, you'll create a "one-to-many" post-relationship, between "Heads" and "Subs", which means that "each head can have multiple subs".
( ref: https://toolset.com/documentation/post-relationships/ )
5. Next, you'll create another "one-to-many" post-relationship, between "Subs" and "Posts", which means that "each sub can have multiple posts".
Once these relationships have been setup, you can use the following guide to create a front-end search filter:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/how-to-filter-posts-by-their-ancestors/
>> I don't know yet if that is going to work if I use relationships between post types.
>> That means: a user has to make a relationship and has to choose 2 categories (headtheme and subtheme) too.
>> 2 things to do (for the same) entails a greater risk of errors.
- The number of steps that user will have to take will remain the same whether hierarchical taxonomy or post-relationships are used.
The heads, subs and their relationships will be added by you (the website's admin), same as in the case of heirarichal taxonomy.
At the time of creating a post, user will only specify the "Sub" to attach to it and the parent "Head" will automatically get linked through that "Sub".
To summarize, you can either:
a). use the heirarichal taxonomy for the search filter and the search won't have the two field, parent and child selection filter or
b). use post-relationships to have the two field, parent and child selection filter in the search, but will also have to add all searchable posts, in a single post type.
For an out-of-box and personalized custom developend workaround, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar