[Resolved] Best way to organize content by location (state, county, city) across post types

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.

This topic contains 2 replies, has 2 voices.

Last updated by chance cobb 1 month ago.

Assigned support staff: Minesh.

Author
Posts
#1642521

I am building a political website that will feature politicians/government officials and their responses to specific incidents/events. I want to be able to show all of the politicians by state, county, and city. I also want to be able to display all of the responses by state, county, and city. I want there to be state, county, and city result pages/archives that have their own layouts so that users can see all of the responses and politicians in their area.

What I am struggling with is how to organize the location data in the system. The state, county, city structure is hierarchal in nature -- which makes me think we need a taxonomy, but we also want to have custom archive pages for these locations, which makes me think we need a custom post type. However, can can we force the hierarchy with post types? For example, if states, counties, and cities are all custom post types, can we force politicians listing to only be associated with one city based on the county and state they are associated with?

Then there are custom fields. Is there a way to have hierarchal custom fields that can be used across post types? Can we use those custom fields to create views or archive pages that are SEO friendly?

For example, we need to be able to have indexed pages that display filtered content. Such as:

official-response.com/ohio/delaware/ -- this would list all of the politicians and responses in Delaware, Ohio
official-response.com/ohio/delaware/responses -- this would list all of the responses in Delaware, Ohio
official-response.com/ohio/delaware/officials -- this would list all of the elected officials in Delaware, Ohio

#1643155

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

If you check our Real Estate reference site:
=> hidden link
- Please check “State” and “City” dropdowns with search form.

where State and City is configured as post types.

To know more and learn about how the "State" and "City" drop-down setup, You can register test site on discover-wp.com to review how its setup and play with it. It’s totally free.
=> https://discover-wp.com/register/?site_type=713&layouts=yes

In your case, it would be ideal to create three post types: state, county and city
Where - you need to create relationship between the post types.
- state has many county (one-to-many)
- county has many city (one-to-many)

You can check the following Doc and there is a video on top that may help you to understand you can create post-relationship:
=> https://toolset.com/documentation/post-relationships/how-to-set-up-post-relationships-using-toolset/

And later, you can not display the repsonses and officials as you stated as given under:
official-response.com/ohio/delaware/ -- this would list all of the politicians and responses in Delaware, Ohio
official-response.com/ohio/delaware/responses -- this would list all of the responses in Delaware, Ohio
official-response.com/ohio/delaware/officials --this would list all of the elected officials in Delaware, Ohio
But
On the singe page: official-response.com/ohio/delaware/
- you should create sections like responses and officials and use view to display the related posts with those sections.

#1643401

My issue is resolved now. Thank you!