Skip Navigation

[Resolved] How to improve directory search

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

Problem: I am creating a directory site with multiple post types. I would like to show custom search Views for each post type and include a taxonomy filter in each search View. I would like to keep the search results and taxonomy filters separated by post type.

Solution: Create the various post types and create one corresponding taxonomy for each post type. Create one custom search View for each post type. Add the corresponding taxonomy filter to each search View.

Relevant Documentation:
https://toolset.com/documentation/user-guides/front-page-filters/

This support ticket is created 6 years, 1 month 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 10 replies, has 2 voices.

Last updated by Charlie 6 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#1164055

I have a directory theme that I have been using. This theme lets me create different Directory Post Types such as in addition to the Listings Directory type I can create a separate Directory type for say Restaurants and or Accommodations. This works okay but the search between the different directory types really is not good if at all. any suggestions on how to use Toolset to make this better?

Thanks..appreciate your help.

#1164057

What is the problem with search that you would like to solve with Toolset? I'm not really clear what you're trying to accomplish. Please provide screenshots showing the problem you would like to solve, and I'll take a closer look.

#1164059

Thanks.. okay I will do that

#1164070
2018-12-11_12-57-10.png
2018-12-11_13-00-19.png
2018-12-11_13-02-38.png
2018-12-11_13-02-53.png

Christian,

I can send you a link by pm or email if you let me know how.

So let me try to explain better. Typically a Directory Theme has only one directory Post type with Listing Categories, tags and locations for business Listings. This theme allows you to create additional Post Types. In a screenshot below you will see that I added Accommodations and Restaurants (out of view) in addition to the Events and Listings Post Types.

The problem I am having is with the search not changing the categories for the selected post type. So it feels as though everything is separate or with limited search ability.

#1164823

Okay thanks for the graphics, this helps. In Toolset there is not a built-in post type search filter, so what you're describing isn't exactly possible. However, you can create separate search Views for each post type, and include different taxonomy and custom field filters in each search View. Then place those search Views on separate Pages of the site. So for example if your Hotels have a custom taxonomy "Hotel Details" then you can include that as a filter in the Hotel search View, but in the search View for Events you would only include filters for Event taxonomies and custom fields.

#1167637

Christian,

Hey thanks so much. Sorry for the delay. Well.. I can really already do what you are suggesting but what the real issue is that it isn't user friendly. Currently someone can change the Custom Post Directory type say from Restaurants to Accommodations but the Category still shows Restaurant Categories.

I have asked the Theme Developer if there are any solutions. My suggestion was for him if it was possible to change the url "map-style/?type=restaurant" to "map-style/?type=accommodations" when the Directory Type is selected and then that would load the proper categories. We will see what he says.

Thanks for your help and reply!

Along these lines I need to add some new taxonomies to a post type that only show up with a specific category. So when the Business Owner wants to add a listing to that category they can fill in the information that pertains to that specific category. Will I be able to create these new taxonomies with Toolset and assign them to the specific Category and then add this to the php code for the Add Business Listing Page so that it will only show for the category they selected?

I am still in the early stages of learning how to use Toolset and I am stuck between trying to build a Directory site from scratch and or trying to modify the existing theme. So huge learning curve for me.

#1167956

I can really already do what you are suggesting but what the real issue is that it isn't user friendly. Currently someone can change the Custom Post Directory type say from Restaurants to Accommodations but the Category still shows Restaurant Categories.
But in my suggestion the category filter options change depending on the post type and its associated taxonomies. It seems like you are not able to do that currently, right? So the suggestion is an improvement, as I understand it.

Along these lines I need to add some new taxonomies to a post type that only show up with a specific category. So when the Business Owner wants to add a listing to that category they can fill in the information that pertains to that specific category. Will I be able to create these new taxonomies with Toolset and assign them to the specific Category and then add this to the php code for the Add Business Listing Page so that it will only show for the category they selected?
Let me clarify a bit more, because it sounds like there is some uncertainty around the terminology here. In WordPress, a taxonomy can be hierarchical, like the "Categories" taxonomy associated with standard Posts. Or a taxonomy can be flat, like the "Tags" taxonomy associated with standard posts. Categories and Tags are separate taxonomies. Whether hierarchical or flat, a taxonomy can include multiple terms. You can associate a taxonomy with a post type, and then you can associate one or more of the taxonomy's terms with any post in that post type.

With that in mind, it sounds like you want your Business Owners to be able to create listing posts in different post types (e.g. Accommodations, Restaurants, etc). When creating those listing posts, you would like the Business Owners to be able to associate different taxonomy terms with their listing. You would like to ensure that Accommodation taxonomy terms don't appear with Restaurant posts when Users search for Restaurant posts on the front-end of the site. You would like to ensure that REstaurant terms don't appear with Accommodation posts on the front-end of the site, and so on for each post type / taxonomy. Am I understanding correctly? If so, then it's no problem because each taxonomy is associated with a single post type, like Restaurant taxonomy, Accommodation taxonomy, and so on. The terms for each taxonomy are separated, and there is no interface for adding the wrong taxonomy's terms to a listing because those other taxonomies are not connected to the post type.

On the front-end, when you create separate Views for each listing type, you will include filters based on the listing type's corresponding taxonomy. Restaurants will be filtered by the Restaurant taxonomy terms, Accommodations will be filtered by Accommodation taxonomy terms, and so on. There is no need for extra PHP code in this setup, it's all handled in wp-admin.

#1167972

Christian,

Thanks. Yes I think you have a good understanding of what I am trying to accomplish.

I know that I wasn't able to edit the existing taxonomies as that is as far as I got testing on the theme. Will I be able to use Toolset to pull in the existing theme Taxonomies and combine them with the ones that I will create with Toolset?

#1168891

Will I be able to use Toolset to pull in the existing theme Taxonomies and combine them with the ones that I will create with Toolset?
I don't really understand the question. Toolset won't disable taxonomies created by your theme, and the terms in the existing taxonomies will continue to be applied to the posts they are currently applied to. None of that changes with Toolset, but you can create new taxonomies and new terms. You can assign those new taxonomies and terms to specific posts, regardless of the existing taxonomies and terms. So if by combining taxonomies you mean can you use taxonomies from Toolset and from your theme simultaneously, the answer is probably yes. If by combining taxonomies you mean you want to import terms from the existing taxonomy into a new taxonomy created by Toolset, that's more complicated.

#1171710

Christian,

Thanks much.. this answered my question "So if by combining taxonomies you mean can you use taxonomies from Toolset and from your theme simultaneously, the answer is probably yes."

This is what I was trying to get too. 🙂

Appreciate it!

#1171711

My issue is resolved now. Thank you!