Skip Navigation

[Resolved] Display items from a repeatable field group on a grandparent template

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

Problem: I am using the Block Editor to create the template for a grandparent post type. I would like to display a list of RFGs from a child post type in the grandparent post template, but the editor says I cannot create nested Views here.

Solution: You must create your inner nested Views in a separate editor, then use the Classic block in your grandparent template to place that inner View using a shortcode.

This support ticket is created 3 years, 10 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 2 voices.

Last updated by Kelly 3 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1645577

Hi! I'm struggling with this one.

I've a post type (mesocycle) which represents a training block for a runner. I've got 2 levels of post type beneath that one which represent parts of the training plan beneath it and have a nice view which when you look at the mesocycle page shows you the items beneath it.

I want to do the same with another post type that is a another child of the mesocycle. This is "form videos" and has a repeating field group in it. That repeating field group has a toolsets video field, a date field and a multiple line text field. If you look at one of its pages, it displays all the videos and associated text nicely.

However, I want to present these videos on the mesocycle page, but can't work out the combination of settings for it to work.

I've tried using the block editor and creating a view which selects the Form Video post related to the mesocycle, and then in that block adding a view which would iterate over the RFG, but I get an error saying I can't do nested views in the block editor.

Any tips to help out?

#1646543

Hello, while you can't build nested Views in the Block Editor, you can create the inner View in the classic Views interface and place it in the Block Editor outer View's loop using a shortcode and a Classic block. The inner View should have a post relationship query filter. The shortcode syntax for placing a View is as follows:

[wpv-view name="your-nested-view-slug"]

You can enable the classic Views builder experience in Toolset > Settings > General. Let me know if you have questions about this.

#1646619

Sleeping on it I managed to get it working! I think I was selecting the wrong options in the query drop down.

Got one last thing I'm trying to do though with it. Here is the structure:

Mesocyle
- Form Video View.
- - View displaying loop of RFG fields
- Place for a <link>

I want to output some text with a link which if you click takes you to the Form video page.

I can kinda get this working by using the block editor to just out put the parent of the RFGs post link, but I want to customise the text. If I get the HTML it is putting in it is outputting this shortcode:

<!-- wp:html -->
Click to view [tb-dynamic provider="toolset_relationship|form-videos|parent" post="current" source="post-title-with-link" force-string='first' ] analysis
<!-- /wp:html --></div>

Can I do something like [wpv-post-link item="@SLUG-OF-RFG.parent"] which is in https://toolset.com/forums/topic/create-a-view-that-lists-all-posts-with-repeatable-field-groups/ ?

I don't know what the slug of the RFG is. If I use [wpv-post-slug] I just get RFG out?

#1646873
Screen Shot 2020-06-01 at 3.04.43 PM.png

You should be able to do something like this:

<a href="[wpv-post-url item='@SLUG-OF-RFG.parent']">Your custom link text</a>

You can find the slug of the RFG by editing the field group. See the attached screen shot.

#1647013

Ah! That was silly of me. I should have looked there. Thanks for that!

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