Displaying a checkbox array from advanced custom field

The way advanced custom field plugin handles checkboxes is in an array so you work with that array, for example if you field name is categories and you want to see if web (on of the checkboxes) was check you can use:

<?php if(in_array('web', get_field('categories') )): ?>
    <h1>Web was ticked!</h1>
<?php endif; ?>

To answer your questions:

  1. How can I print out the real names (without it saying array)?

if you want to print out the names instead of the array you can use:

$cats = get_field('categories');
echo '<ul>';
foreach ($cats as $key => $val){
    echo '<li>'.$val.'</li>';
}
echo '<ul>';

this should give you something like:

  • option_1
  • option_2
  • option_9

2 Also say if it = web and matches the
page title then echo something?

just like the first code snippet but just add another condition:

<?php if(in_array('web', get_field('categories') ) && $post->post_title == "web"){
     echo  '<h1>Web was ticked! and matches the page title</h1>
}