Home › Forums › General Issues › Retrieve multiple checkbox values outside foreach loop › Reply To: Retrieve multiple checkbox values outside foreach loop
You won’t be able to output all of them unless they are in your loop. I’m not sure what your initial $discipline; call is as well as the one within your loop. You’re not doing anything with it there.
You’ll need something like this:
<?php
$output_map[$the_ID]['map'] = '<div class="marker" data-lat="'.$location['lat'].'" data-lng="'.$location['lng'].'"></div>';
$disciplines = get_field("form_disciplines");
// $discipline; not sure what this is?
if( $disciplines ):
foreach ($disciplines as $discipline) {
echo '<p>' . $discipline . '</p>';
}
endif;
?>
Your map marker output doesn’t include any of the code in your loop so you can put it before or after your foreach loop depending on where you need it.
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.