Skip Navigation

[Resolved] Advice on site setup

This support ticket is created 6 years 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 1 reply, has 2 voices.

Last updated by Christian Cox 6 years ago.

Assisted by: Christian Cox.

Author
Posts
#1180973
2_county-city-list.png
1_state-list.png

I have .csv with a list of some U.S 25,000+ city names, each of which has corresponding state and county names attached to them. The information will be used to generate shortcodes to display dynamic custom content pages. FYI - I have the plugin - ' WP Ultimate CSV Importer Pro'.

Questions:
1.How do you recommend I set up the structture. Should I have separate CPT for Cities, Counties & States and use a relationship setup. Or should I use Taxonomies.

2. In addition to displaying the city names and information on dynamic pages, I need to be able to display a hotlinked unordered list of all the states, Please see attached: "1_state-list.png".

3. I also will need to display on each state's page a hotlinked unordered list of their corresponding counties and a sub-unordered list of each counties cities. Please see attached: "2_county-city-list.png".

Many thanks

#1180997

1.How do you recommend I set up the structture. Should I have separate CPT for Cities, Counties & States and use a relationship setup. Or should I use Taxonomies.
It could be accomplished either way but a Custom Post Type is probably better. Custom Post Types get their own URL structure and archives automatically, set up by WordPress. So you would have these URLs like this generated automatically with custom post types:
site.com/city/charleston/
site.com/county/charleston/
site.com/state/south-carolina/
On those pages, you can set up a template to display information about each location. You can apply different templates based on the post type. You can include custom field information in each of those templates, which can make the location page dynamic.
You would also get these URLs automatically:
site.com/city/
site.com/county/
site.com/state/
Toolset's WordPress Archives can be used to design the content of these pages, where you can include a list of all the corresponding posts and other information, like on the city archive you can show which county it belongs to.
One drawback of post relationships is there are some limitations to custom searches based on related posts. For example, I can't let Users filter a View of Cities by a custom field in their parent County post. Some improvements are planned for this, but I don't have an ETA available.

If you use Taxonomies, you get the same URL structures with WordPress Archives. However, if no posts exist with a taxonomy term applied, that term gets no archive and the URL will be a 404. It's a quirk of how WordPress works, and there's not an easy way around it. Also, you cannot use a taxonomy to relate terms to other taxonomy terms. For example, maybe you want to use a taxonomy on City posts to define small, medium, and large cities. You could do that easily with a taxonomy. However, if you use a city taxonomy to organize cities, then you cannot relate cities by taxonomy. Terms can't be used to categorize other terms. Also there is no parametric search for Taxonomy terms.

2. In addition to displaying the city names and information on dynamic pages, I need to be able to display a hotlinked unordered list of all the states, Please see attached: "1_state-list.png".
Sure, you can use Views to create unordered lists whether you choose to go with taxonomy terms or custom post types. You can insert links to those term archives or custom post permalinks using Toolset's shortcodes, or you can build custom link structures using HTML and shortcodes.

3. I also will need to display on each state's page a hotlinked unordered list of their corresponding counties and a sub-unordered list of each counties cities. Please see attached: "2_county-city-list.png".
If you go with Custom Post Types, you will can use Views to create lists of related posts. So the View of Counties would include a post relationship filter that filters by the current State. In that View, you would output a list of the related Counties, and include the county name or permalink to the count post.

Inside the View of related Counties, you would nest a View of related Cities. Again, output a list of the related Cities with the city name, link or other custom field information.

If you decide to use taxonomies instead, you can do something similar with a View of this hierarchical taxonomy. The outermost View will have a term parent filter applied, where the parent is "None". This will loop over the States (highest hierarchical level). Then you will nest two more Views of the taxonomy with term parent filters, set by the current term in the loop. Each of those Views will loop over one level of terms in the hierarchy.

Toolset does not provide a collapsible or toggled design out of the box, so you could use Bootstrap or your own custom code to create those interface elements.