Home › Forums › Backend Issues (wp-admin) › Multiple values for checkbox choices › Reply To: Multiple values for checkbox choices
I would go with what you are doing or code it. Coding could run into a lot of code, depending on how it is coded.
here is one example, and it is not complete
To make it easier you can return the value and the label of the field, this is one of the options for the checkbox field. And if you have values set like
WordPress : WordPress
Plugin A : Plugin A
Plugin B : Plugin B
$values = get_field('my_check_box');
if ($values) {
?>
<ul>
<?php
foreach ($values as $value) {
$icon = 'fa ';
switch ($value['value']) {
case 'WordPress':
$icon .= 'fa-wordpress';
$url = 'https://www.wordpresss.org/';
break;
case 'Plugin A':
$icon .= 'fa-acorn';
$url = 'url here';
break;
case 'Plugin B':
$icon .= 'fa-apple';
$url = 'url here';
break;
default:
// assign a generic icon
$icon .= 'fa-something';
$url = '#';
break;
} // end switch
?>
<li><i class="<?php
echo $icon; ?>"></i><a href="<?php
echo $url; ?>"><?php echo $value['label']; ?></li>
<?php
} // end foeach value
?>
</ul>
<?php
} // end if values
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.