I have an ACF repeater field setup on a page and within the subfields I have a True/False checkbox. So far, if the box is checked, it will show the fields. If not then it will not.
However, the one thing I can't figure out is how to get it to check to see if nothing is checked, to only echo out something, but since it's in the while loop, it just keeps outputting for each sub field.
Here's my code:
<?php if( get_field('position') ) : while( has_sub_field('position') ) : $value = get_sub_field('active_position'); $title = get_sub_field('position_name'); ?> <?php if( $value == true ) : ?> <p> <?php echo $title; ?> </p> <?php else : ?> <p> nothing available... </p> <?php endif; ?> <?php endwhile; endif; ?>
I'm not sure how to get it so it checks to see if anything is "checked". If so, then display the results, but if nothing is checked then return something else only once.