Skip Navigation

[Resolved] show related post in one to one relationship among other things in related post

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

Problem:

Setup a view to query related posts.

1) Two custom post types: CPT A and CPT B
with one-to-one relationship "CPT A 1to1 CPT B"

2) in the single "CPT A" post, you are going to display related "CPT B" post

Solution:

You can create a view list CPT B posts, filter by:
Select posts in a "CPT A 1to1 CPT B" relationship that are related to the Post where this View is shown

Relevant Documentation:

https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/

This support ticket is created 6 years, 6 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 2 replies, has 2 voices.

Last updated by JosV9233 6 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#861913

I have two custom post types in a one to one relationship. In one custom post I want to show the related post. I made a view to display all the fields. The problem is, how do I choose the right view of the related post.

I have tried it with post-id, also with [wpv-view name="bp" limit="1" offset="x"], where x is a certain number, but I cannot target the related post (shown in the view).

Is there a way like this [wpv-view name="bp" limit="1" offset="x"] to target the right related post/view?

#864522

Hello,

Please elaborate the question with more details:
how do I choose the right view of the related post

I assume we are talking about this:
1) Two custom post types: CPT A and CPT B
with one-to-one relationship "CPT A 1to1 CPT B"
2) in the single "CPT A" post, you are going to display related "CPT B" post

If it is, you can create a view list CPT B posts, filter by:
Select posts in a "CPT A 1to1 CPT B" relationship that are related to the Post where this View is shown

See our document:
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/

#865009
thumb-up.jpg

Thank you Luo Yang, you showed me how to proceed.