Support

Account

Home Forums Front-end Issues Hiding empty fields Reply To: Hiding empty fields

  • 
    <?php 
        $fields = get_field_objects();
        if ($fields) {
            foreach($fields as $field_name => $field) {
                if ($field['value']) {
                    echo '<div>';
                    echo '<h3>' . $field['label'] . '</h3>';
                    echo $field['value'];
                    echo '</div>';
                } // end if field value
            } // end foreach fields
        } // end if fields
    ?>