Skip Navigation

[Resolved] Trouble showing relationship of item in loop

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

Problem: I would like to display a grid of 'resources' that are in relationship with a topic on that topics page. Easy enough, but I would also like to display on that grid the Author of the resource. From my research, seems like I would need to create a nested view. I got it to work using the legacy 'views' but I'm not able to use any of the styling options available in the block editor (grid styles, border radius, etc.)

Solution: It may be necessary to use a nested view if the post relationship is many-to-many, or it may not be necessary if the post relationship is one-to-many. You may also be able to use the Block Editor to design the loop template of the nested View, separately from the editor of the parent View.

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

Last updated by davidE-15 4 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#2006791

# Tell us what you are trying to do?

I have custom post types for:
- Resources (Sermons, article, etc)
- Topics
- Authors

I have relationships set up to connect topics, and authors to a resource.

I would like to display a grid of 'resources' that are in relationship with a topic on that topics page. Easy enough, but I would also like to display on that grid the Author of the resource. From my research, seems like I would need to create a nested view. I got it to work using the legacy 'views' but I'm not able to use any of the styling options available in the block editor (grid styles, border radius, etc.)

# Is there any documentation that you are following?

Just googling stuff.

# Is there a similar example that we can see?

# What is the link to your site?

Only local currently. But here is a 1 minute demo showing what I'm talking about. hidden link (Turn up volume)

I believe that when nested views inside the block system is released this will probably fix that issue. However I may look for another solution if that is still a ways off.

Thanks so much!

- David Eiffert

#2006819
Screen Shot 2021-03-31 at 6.57.34 PM.png
Screen Shot 2021-03-31 at 6.56.56 PM.png

I would also like to display on that grid the Author of the resource. From my research, seems like I would need to create a nested view.
It depends on the relationship between Authors and Resources. If it's a many-to-many relationship, you'll need a View because there can be more than one Author connected to any hypothetical Resource. If it's a one-to-many relationship, you don't need a View. The dynamic sources feature in Blocks is smart enough to know that only one Author can be related to any Resource, so you can select to display information from the related Author in a Single Field block's dynamic sources. Just drag a Single Field block into the loop of the Resource View, then use the dynamic sources feature to select the related Author post as the dynamic source for that field.

You'll always need a View to display the "many" side of a relationship, but if you're trying to display the "one" side, it's not necessary.

Another option is to use the Block Editor to design the loop template of your nested View after you create it in the legacy editor. You won't be able to design it in the context of the parent View, but you will be able to use the Block Editor to design the results of the nested View in a separate screen. See the screenshot here for the location of that feature in the legacy Editor. When you use the Loop Wizard in the Loop editor area, you will be given the option to create a template for the loop, then you can edit that template in the Block Editor.

#2006841

Oh man!!!!! Wow, such a detailed and helpful response. Using the block editor to design the loop template of the nested view works perfect. Thanks Christian.

My issue is resolved now. Thank you!