Skip Navigation

[Resolved] Display parent – other relationship – child – field

This support ticket is created 6 years 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 8 replies, has 2 voices.

Last updated by laszloB 6 years ago.

Assisted by: Shane.

Author
Posts
#903032
parent-child.jpg

Is there a way to display "A" custom filed in "Filmek" post view (see attachment)?

#903174

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for contacting our support forum.

From this I see that you want to display the brother posts.

Have a look at the link below and this should be able to assist you.

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

Please let me know if this helps.
Thanks,
Shane

#903779
display-brother-post.jpg
display-cousin-post.jpg

Hi,

Display "brother" post is OK (green line).
My question is: How can I display "cousin" post (red line)?
Cousin post is in other relationship.

I did not find a solution in Toolset User Guides.

#903897

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Laszlo,

I thought about this but there isn't an easy way to do this and would require some custom code to achieve.

Since the field in in a completely different CPT and the only relationship between then is the Parent. Then in order to target that exact post that you ant you will need to know its ID.

Now this is more complex if there are many posts of Post Type A with the same parent because we simply can query based on the parent ID because you will return a number of posts from A with the same parent.

Thanks,
Shane

#904001

Sorry if my writing was unclear.
I would like to display ALL the posts of Post Type A!

#904068

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screen Shot 2018-05-25 at 2.37.26 PM.png

Hi Lazlo,

So finally one more question, Is it that on Post Type B, you want to list all of Post Type A with the similar parent.

If so then here is what your need to do.

Create a view that would list Post Type A. Then to this add a query filter for the Post Parent. See Screenshot.

Then just add this view to your content template and pass the parameter for the parent ID into the view.

Example

[wpv-view name='myview' wpvchildof='[wpv-post-id item="@manufacturer-car.parent"]']

Where you will replace @manufacturer-car with the slug of your parent.

Please let me know if this helps.

Thanks,
Shane

#904383

Hi,

I tried it.
I create a view (esemeny-filmblokkhoz slug) for list "Post Type A" with query filter.
Put this view to "Template for Filmek" with your shortcode.
The result: list all of "Post Type A".
I want: list all of "Post Type A" with the similar parent (filmblokk slug)!

[wpv-view name='esemeny-filmblokkhoz' wpvchildof='[wpv-post-id item="@filmblokk.parent"]']

I tried altarnative codes:
[wpv-view name='esemeny-filmblokkhoz' wpvchildof='[wpv-post-id item="@filmblokk-film.parent"]']
[wpv-view name='esemeny-filmblokkhoz' wpvchildof='[wpv-post-id item="@filmblokk-esemeny.parent"]']
[wpv-view name='esemeny-filmblokkhoz' wpvchildof='[wpv-post-id item="anything"]']
{!{wpv-view name='esemeny-filmblokkhoz' wpvchildof='{!{wpv-post-id item='@filmblokk.parent'}!}'}!}
The result: list all of "Post Type A" also...

(I use DIVI theme)

#905074

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Laszlo,

You're saying that this didn't work correct?

Would you mind providing me with access so that I can have a deeper look at this for you ?

Thanks,
Shane

#905255

Solved. 🙂

Query Filter in view:
Filter by post relationship or repeatable fields group owner
- Select items "in the Filmek Esemenyek relationship" as related items of...
- The post with ID set by the shortcode attribute "wpvrelatedto"

Contenet Template:
{!{wpv-view name="esemeny-filmblokkhoz" wpvrelatedto="[wpv-post-id item="@filmblokk-film.parent"]"}!}

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.