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.
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 5 years, 11 months ago.
Assisted by: Christian Cox.