Skip Navigation

[Closed] Is this possible? (Hierarchy question)

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 10 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 5 replies, has 2 voices.

Last updated by Adriano 10 years, 6 months ago.

Assisted by: Adriano.

Author
Posts
#147075

Hi Guys, just wondering if the following is possible using the Types plugin?

I need to somehow do the following:

Add types of Country, City and Airport

Make a hierarchy of Country > City > Airport (i.e you can only add a city to a country and an airport to a city etc)

Make the URL reflect this:
Country: /united-kingdom
City: /united-kingdom/london
Airport: /united-kingdom/london/heathrow

Could someone let me know if this is possible with this plugin?

Many thanks,

Dave

#147263

Dear daveH-2,

Yes, I think so. The whole environment should be:

- To create 3 custom post types
- Assign Country as parent of City and City as parent of Airport
- In the Advanced section of all custom post type config page you need to check the "hierarchical" option

Please take a read here: https://toolset.com/documentation/user-guides/creating-post-type-relationships/

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

#147268

Hi Adriano. Thanks for your reply.

I did try what you said previously, but ideally I need it to not allow a city to be added without selecting a parent country. When adding a city, I couldn't even see a way to select the parent - should I be able to?

Also can the URLs be adjusted to take the hierarchy into account, i,e: /united-kingdom for a country, /united-kingdom/london for a city and /united-kingdom/london/heathrow for an airport?

Many thanks,

Dave

#147503

Dear daveH-2,

Unfortunately that's a limitation from WordPress. If you are creating a post and need to set a parent that is from other custom post type, first you need to save the child and then you are able to select the parent.

We have another solution in cases like this (I think that's not for you because you needs 3 level of relationship) that is hide the child custom post type from our GUID (it doesn't appear on left admin menu) and only can add it in the country page (child fields section). The problem is that you can't do this for City > Airport because the City custom post type doesn't appear on admin menu.

If you set hierarchical option In the Advanced section of your custom post type edit page, the URL should be hierarchical.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

#147580

Thanks Adrian,

I have it set up how I need it to be in the admin so all good there. The URLs I have enetered as I require in in wp_posts guid field.

Is there any way I can make the plugin use the guid rather than doing it's own URL?

Many thanks,

Dave

#147969

Dear daveH-2,

You can change the WordPress permalinks format in Settings > Permalinks. The default option is the GUID.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

The topic ‘[Closed] Is this possible? (Hierarchy question)’ is closed to new replies.