Display HTML only if Custom Field has a Value
You can use the “get_sub_field” to test for the subfields. If nothing is returned and they are empty, it won’t show the content associated with the if statement. <?php if ( get_field(‘ingredients-list’) ) { echo ‘<ul class=”ingredientsList”>’; while ( has_sub_field(‘ingredients-list’) ) { echo ‘<li class=”ingredient” itemprop=”ingredients”>’; echo ‘<label for=””>’ . get_sub_field(‘quantity’) . ‘ ‘; if … Read more