Home › Forums › Add-ons › Repeater Field › Add Class to Repeater Field w/ Checkbox › Reply To: Add Class to Repeater Field w/ Checkbox
Hi @robertrhu
Thanks for reaching out to us.
As opposed to using a checkbox, I would recommend using a true/false field. This will return true if selected and thus you can display the selected sub_field.
If you would like to make use of the display none, you may do it as follows
<?php
$selected = get_sub_field('field_name','option');
$html = "<div "
if(!$selected)
$html.='style = "display:none;"';
$html.=">My FAQ content here </div>";
?>
Hope this helps.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.