Hello 🙂
I just got into the relationship part, and it seams promising.
Type: One to Many
Parent CPT (one): Layouts - slug: layout
Child CPT (many): Layout Templates: slug: layout-template
An example will be:
Layout name: Life Style
Layout Templates: Home - Services - Contact
The URL goes like this.
domain.com/layouts (seeing all my layouts)
domain.com/layout/life-style (showing this layout overview)
domain.com/layout-template/home (showing the home page in the above layout)
What I want is this URL:
domain.com/layout/life-style/home
I can't figure out to get this URL. I've played around in the dashboard for my post types with no luck.
Basically, I want to add the parent relationship URL and then the child
-------------------
Hope you can help me 🙂
Keviin
Dear Keviin,
There isn't such kind of feature within two different post types, it'd require elaborated Custom Code.
I suggest you try to merge post type "Layouts" and "Layout Templates" into one hierarchical post type, just like the wordpress built-in post type "Page", for example, edit post type "Layouts", in the section "Options", enable option "hierarchical".
More help:
https://developer.wordpress.org/reference/functions/register_post_type/#parameters
'hierarchical'
(bool) Whether the post type is hierarchical (e.g. page). Default false.