Skip Navigation

[Closed] Setting up City and State for Archive Search Pages

This support ticket is created 3 years, 10 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.

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)

Author
Posts
#1953731

I am in the process of setting up a local directory-type site from scratch and trying to figure out the best way to add the City, State and Zip. Not sure what is the best setup. And I have searched far and wide online trying to find an answer.. seems like this would be an important topic to tackle.

This is one page that talks about a possible solution.
https://toolset.com/forums/topic/location-cities-and-districts-as-custom-post-type-or-taxonomy-and-why/

I have searched the docs and support forum and posted in the FB group but still I am not sure I have found the solution so I am reaching out to you in support.

Most of the docs show and refer back to the example on the WP-discover site for Real Estate: C & B Properties where it has a separate CPT for Cities and one for States and is using a one to many relationships for the cities.

I understand how this works but I think one thing is missing. While it works good for selecting a state and then the cities in that state. I am unsure how this is going to work for SEO and breadcrumbs. Because you end up archive pages with url's like domain/state/az and or domain/city/phoenix.... and it should be domain/az/phoenix right?

Would not creating a CPT for States and then hierarchical for Cities and then have relationships for the cities in that state not be a better solution? would be a lot to setup but seems like it might be a better solution.. or maybe I am missing something like for the archive pages.

Can you help me understand what would be a better solution?

Thanks.

#1954243

Hello, if I understand correctly, the problem is that the URLs produced in the current custom post type setup are not SEO friendly and you would prefer a different URL structure for child posts. If that is correct, then the best solution is probably to find a 3rd-party custom permalink plugin that will help you achieve the URL structure you desire, rather than re-engineering the post relationships involved and the search filters offered in custom search Views. Toolset's post relationships exist independently of permalink structures, and Toolset's custom post types adhere to the standard WordPress URL structure of /{post-type-slug}/{post-slug}. If you're looking for a more custom permalink structure, like /{parent-post-slug}/{post-slug}, Toolset doesn't really offer any good solution to that problem since that permalink structure is not based on any of WordPress's standard custom post type URL structures. A 3rd-party tool is probably better suited to help you achieve exactly what you're looking for here.

If you need assistance accessing related post information with PHP for a 3rd-party tool, for example a way to get the parent post slug given the child post ID, I can show you how to use the Toolset post relationships API to access that information. We also have documentation available here: https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/ I suppose it depends on how the third party tool you select works, and how it allows you to customize URL patterns. I don't really have a good recommendation for you, but I can offer assistance with any Toolset APIs required to get the information you need.

#1954547

Christian,

Thanks for the quick reply. ahh... sounds like I am asking for the impossible when it should be the standard LOL.

But I understand that my journey is not ending but only beginning. Thanks for your help. If I can't figure this out I will reach back out.

#1954665

Okay sure, I'll stand by for your update.

The topic ‘[Closed] Setting up City and State for Archive Search Pages’ is closed to new replies.