Skip Navigation

[Resolved] Nested View inside View of related posts

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

Problem: I have a View of related posts in an M2M relationship. In that View, I would like to display related posts from a different M2M relationship.

Solution: Create a Content Template for the original related posts View and insert it in the View's loop using a shortcode. Then use the Block Editor to create the nested View of related posts from another M2M relationship.

Example Content Template shortcode:

[wpv-post-body view_template="your-template-slug" item="@relationship-slug.parent"]

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153372

This support ticket is created 3 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 3 voices.

Last updated by Anthony 3 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#2080469

I have two M2M post relationships between Artists and Products - "Performing On" and "Release Artist". In the Content Template for Artists, I have a View showing related Products in the Performing On relationship. In the results of that View, I would like to display related Artists from the other relationship, "Release Artist". How can I set this up?

#2080621

I gave this a go, starting with a legacy View - and didn't get past establishing the Query Filter... so I definitely do need help with this...

#2082039

Shane
Supporter

Languages: English (English )

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

Hi Anthony,

Christian is currently out sick today but should be back tomorrow to continue assisting.

You should get a response from him or another supporter tomorrow should he be out again tomorrow sick.

Thank you for your continued patience on this one.

Thanks,
Shane

#2083483
Screen Shot 2021-06-10 at 11.03.19 AM.png

To preserve Block Editor editing capabilities as much as possible, I've created this View directly in the Blocks Content Template I created here:
hidden link
You can edit this View completely in the Block Editor now, since I've included this Content Template in the Collaborations View in a way that sets the related Product post context correctly. I've created a basic design for you and set up the post relationship filter correctly, so that the Artist(s) from the Related Artists relationship for the current Product is displayed in the results. Feel free to make modifications to the View directly in the Block Editor for this Content Template.

#2083517

Beautiful, excellent, wonderful - my issue is resolved now. Thank you!