[Resolved] Trying to create a business directory with multiple towns (each business has CPT
This support ticket is created 7 years, 7 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.
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'd like to be able to present the following front end views:
Town-wide lists
/towna/businesses/ --> A list of all the businesses in town A
/towna/events/ --> A list of all events in town A
/towna/promotions/ --> A list of all promotions in town A
Town + category lists
/towna/businesses/cafes/ --> A list of all cafes (based on business category)
/towna/events/cafes/ --> A list of all events run by cafes (based on business category)
/towna/promotions/cafes/ --> A list of all promotions in cafes (based on business category)
Since the list of towns is short (<5) and they're not hierarchical (i.e. no town is a subset of another town), I could create a "town" CPT and set all businesses as children. However, it feels like Taxonomies are the right fit for this use case.
Please could you give me some guidance whether I should use a town "parent" CPT or taxonomies to achieve the above. Any guidance would be great.
I agree with your own assessment, that taxonomies would work well for the towns, and the taxonomy queries would be more efficient than the hierarchical relationship queries which are based upon post meta.
To take a couple of examples from your question:
/towna/businesses/cafes/, you would have a View to show businesses with the location taxonomy of towna and businesses category of cafe.
/towna/events/, you would have a View which returned businesses with location taxonomy towna. You wouldn't output anything of the businesses, your loop output would be a nested View which showed events whose parent was the current item in the loop (the output of which would doubtless refer to fields of the parent business using the id="$parent" parameter).
If you need help setting up any of the views let me know.
Thanks for getting back to me and confirming that I'm on the right lines. I'm a complete n00b to Toolset so been doing a lot of Googling! Any help you could give me (point me to relevant examples for your suggested nesting etc) would be great. Sadly, I'm developing locally at the mo so can't give you access to my install.
Reviewing this I see you had some follow up questions even though you marked the thread as resolved, so let me re-open it to point you towards a couple of relevant pieces of documentation.
If you have a general question about the set-up you can continue with this thread.
If you have specific implementation questions it would be more helpful to start a new thread (we try to keep threads to a single topic to help others researching the same issue in the forums).
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.