Skip Navigation

[Resolved] Link to other CPT's with Same Parent Relationship (Product)

This support ticket is created 2 years, 11 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 2 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#2316943

Tell us what you are trying to do?

Unsure whats the best way to go about this...

Relationships:
Product>Manual
Product>Troubleshooting
Product>Part Diagram

I use the same slug path(product-name) for all pages Product,Manual,Troubleshooting, and Parts Diagram

--------------------------

What im trying to achieve

I like to link to the other cpt's that have the same post relationships

Manual - create links to Troubleshooting, Parts Diagram
Troubleshooting - create links to Parts Diagram, Manual
Parts Diagram - create links to Manual, Troubleshooting

#2317091

Hello,

How do you setup the post type relationships?

Product>Manual
Product>Troubleshooting
Product>Part Diagram

The character ">" means one-to-many relationship?

If it is, you can try these:
1) Create a content template for example "product-info", display the product information + related child post views:
- Troubleshooting
- Part Diagram
https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items

2) In single "Manual" post, display above content template shortcode with item attribute, for example:
[wpv-post-body view_template="product-info" item="@product-manual.parent"]

More help:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
If your current post is in a relationship acting as child post, you can use the value of @{relationship-slug}.parent to obtain data from the related parent.