php - Advanced Custom Fields checkbox inside repeater -
i'm trying use checkbox inside repeater field show different images. if user checks "chicken" , "roast" must display 2 images front-end. if nothing checked, nothing displayed.
i have tried advanced custom fields documentation , can null or these names "chicken" , "roast" front-end. piece of code inside repeater loop.
<?php if (get_field('selection') == 'chicken') { ?> //some piece of code <?php } else if (get_field('selection') == 'roast') { ?> //some more code <?php } ?>
a checkbox creates list of check-able items. in other words, need check string in array()
. example:
if( in_array( 'chicken', get_field('field_name') ) ) { //... }
read more checkboxes in acf codex: http://www.advancedcustomfields.com/resources/checkbox/
Comments
Post a Comment