Problem: I have a View showing the repeatable field groups (RFGs) for a specific post. Inside the View of RFGs, I would like to create a conditional that tests whether or not the checkbox custom field in the parent post is checked.
Solution:
Use the @repeatablefieldgroupslug.parent syntax in the id attribute of the wpv-post-field shortcode to access the raw value of the checkbox custom field in the parent post. A checkbox field will normally have the value 1 if checked, so your conditional will look like this:
[wpv-conditional if="( '[wpv-post-field name='wpcf-premium' id='@repeatablefieldgroupslug.parent']' eq '1' )"] Checkbox is checked[/wpv-conditional]
Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/
https://toolset.com/documentation/customizing-sites-using-php/functions/
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.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
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)
Ce sujet contient 4 réponses, a 2 voix.
Dernière mise à jour par Il y a 5 années et 11 mois.
Assisté par: Christian Cox.