Problem: I have a View of custom posts. I have a custom field applied to those posts. Depending on the value of that custom field, I would like to apply a different Content Template to each item in the Loop.
Solution:
Use conditional HTML to test the value of the custom field, and show or hide the corresponding Content Templates.
[wpv-conditional if="( $(type-of-post) eq '1' )"] [wpv-post-body view_template="template-1-slug"] [/wpv-conditional] [wpv-conditional if="( $(type-of-post) eq '2' )"] [wpv-post-body view_template="template-2-slug"] [/wpv-conditional] [wpv-conditional if="( $(type-of-post) eq '3' )"] [wpv-post-body view_template="template-3-slug"] [/wpv-conditional]
Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
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, 1 mes.
Asistido por: Christian Cox.