Skip Navigation

[Resolved] Custom URL structure as in posttype/posttype/postslug

This thread is resolved. Here is a description of the problem and solution.

Problem:
Can I create a URL like the below, using 2 Post types?

 
site.com/posttype/posttype/postslug

Solution:
No, it's not possible.

https://toolset.com/forums/topic/how-to-achieve-this/#post-453939

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 hossamH-2 4 years, 10 months ago.

Assigned support staff: Beda.

Author
Posts
#453886

I am trying to have custom post type 'country' and custom post type 'city' in a way so when I visit site.com/france/paris I should see a snipped about 'france' and 'paris' from their posts. To my understanding I can achieve this with this product and I even can make use of the almighty Visual Composer to design the landing pages nicely from the post fields and contents.

I am not sure though about the permalink and can't see in my mind how it should work.

Is this even achievable? If yes, how?

Thanks in advance!

#453939

No, this is not possible, because Post Types are not nestable as you suggest in the above URL Structure.

You can do that in Taxonomies, means France would be the Taxonomy and City the Term (Paris)

I rather suggest to create a parent/Child relationship with Toolset Types where you can create a parent post (France) and then assign several Child posts (Cities) to it.

But the URL will still be by WordPress standards, means, you will see /france.
And then you can list with a view all related Child Posts (Cities) on that Post.

DOC:
https://toolset.com/documentation/user-guides/many-to-many-post-relationship/
https://toolset.com/documentation/user-guides/displaying-related-child-posts/

#454031

Thanks for your couple of resources; I believe this is what I needed as a guidance.