Created
June 10, 2016 20:44
-
-
Save tomfinitely/e93b2c3eff30e0ee94d3ded11fec00d9 to your computer and use it in GitHub Desktop.
WordPress Advanced Custom Field (ACF) - Conditional Checkboxes with Labels as Output (with option of Values as URLs)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Program Locations | |
$program_locations = get_field( 'program_locations' ); | |
if ( $program_locations ) { | |
echo '<section class="location-widget widget widget_text"><div class="wrap widget-wrap">'; | |
echo '<h4 class="widget-title widgettitle">Program Locations</h4>'; | |
$field = get_field_object('program_locations'); | |
$value = $field['value']; | |
$choices = $field['choices']; | |
echo '<ul>'; | |
/* | |
foreach ($field['value'] as $value => $label) { | |
echo '<li><a href="' . $label . '" class="icon-angle-right">' . $choices[ $label ] . '</a></li>'; | |
} | |
*/ | |
foreach ($field['value'] as $value => $label) { | |
echo '<li>' . $choices[ $label ] . '</li>'; | |
} | |
echo '</ul></div></section>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment