Problem: I would like to use conditional HTML to show or hide content depending on whether or not there are any entries in the repeating field group associated with the current post.
Solution: There's no syntax in a conditional to check for the existence of entries in a repeatable field group, but you can use a View instead:
- Create a View of this RFG and add a post relationship filter where the parent is set by the page where this View is displayed.
- Set a limit of 1 result, since that's all you need to know.
- In the Loop Editor, click "Skip Wizard" since you don't need to build a Loop.
- In the wpv-items-found tags, include Views shortcodes or Types shortcodes necessary to display content when results are found. If you want to display information from the parent post instead of the RFG, use the id="$current_page" option in the field shortcode like this:
[types field="your-field-slug" id="$current_page"][/types]
- Insert the View in the current post template.
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.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
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)
Este tema contiene 6 respuestas, tiene 2 mensajes.
Última actualización por hace 6 años, 2 meses.
Asistido por: Christian Cox.