Home › Forums › Front-end Issues › How show input checkbox in page template › Reply To: How show input checkbox in page template
Firstly, your choices need to be like this
1 : Label for 1
Please note the space on both sides of the colon
2 you need to set the return value to return the value and the label in and array
Then you need to follow the documentation https://www.advancedcustomfields.com/resources/checkbox/
and you need to supply the user for the user that you want to show when your getting the field https://www.advancedcustomfields.com/resources/how-to-get-values-from-a-user/
$subs = get_field('field_name', $post_id);
if ($subs) {
?>
<ul>
<?php
foreach ($subs as $sub) {
?>
<li><?php echo $sub['value'],': ',$sub['label']; ?></li>
<?php
}
?>
</ul>
<?php
}
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!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc
— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.