Hi!
I am using this code to show field label and value:
<?php $field_name = ( ‘youtube’ );
$field = get_field_object($field_name);
echo $field[‘label’] . ‘: ‘ . $field[‘value’]; ?> <br>
Please help integrating code for hiding the field if it is empty. At the moment field label is still showing up if the field has no value.
Thx!
I do not see “if” conditional there. Something like this, cannot test now.
<?php if( get_field('youtube') ): ?>
<?php
$field_name = ( ‘youtube’ );
$field = get_field_object($field_name);
echo $field[‘label’] . ‘: ‘ . $field[‘value’]; ?> <br>
?>
<?php endif; ?>