Saltar navegación

[Resuelto] Nested views with repeatable fields not displaying in Content Template

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:
A post type has a repeatable field group which itself contains a nested repeatable field group. When displaying the post, how to display the nested field groups?

Solution: Add a View to the post template which displays the first-level repeatable field group, which includes a Query Filter to display field groups which belong to the post where this View is shown.

In the Loop Output section insert another View, which displays the second-level field group, and which includes a Query Filter to to display field groups which belong to the current post in the Loop.

This support ticket is created hace 6 años, 4 meses. 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por joshM-4 hace 6 años, 4 meses.

Asistido por: Nigel.

Autor
Mensajes
#1083103
Screen Shot 2018-08-14 at 11.44.49 AM.jpg
Screen Shot 2018-08-14 at 11.37.51 AM.jpg

I am trying to: display repeatable fields (that have repeatable fields) in a content template

Link to a page where the issue can be seen: enlace oculto

I expected to see: Results in the "The Results" section near the bottom.

Instead, I got: "No Items Found"

I'm sure it's something simple, but this is the first time I've worked with repeatable field groups. I appreciate your help and patience.

#1083575

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Hi Josh

I looked at your site and spotted the problem.

In your second, nested, View to display the nested "Results Metrics" RFGs the Query Filter was set to show posts related to "the post where this View is shown".

That is the case study.

But this View is nested inside another View, and the Results Metrics RFGs are related to the parent Results RFGs, not the case study posts.

So the correct setting for the filter is to show posts related to "the current post in the loop".

(The implementation of RFGs uses posts to act as a container for its fields, so if you checked in the database in wp_posts you would find a post for each Results Metrics RFG, for example, with corresponding entries in wp_postmeta for the custom fields. So the Results RFGs are actually child posts of Case Studies, and Results Metrics RFGs are child posts of Results.)

#1083766

Nigel, thank you. That makes complete sense. I knew it had to be something simple I was missing.

Problem solved. Have a good one.