Support » Plugins and Hacks » Advanced Custom Fields » [Resolved] Condition if field is blank

[Resolved] Condition if field is blank

  • Hi, I am displaying the the values of my custom fields with labels, like this.

    <h5 class="semibold">Preperation Time</h5>
    <?php the_field('prep_time'); ?>

    The problem is the label will always be there even if the field has no value. Now I want to make a condition something like this

    if field_name has value{
    <h5 class=”semibold”>Preperation Time</h5>
    <?php the_field(‘prep_time’); ?>

    how can I do that?, thanks.


Viewing 1 replies (of 1 total)
  • done — I used this code

    <?php if (get_field('cook_time') && get_field('cook_time') != "") { ?>
    <div class="left recipe-detail">
    <h5 class="semibold">Cook Time</h5>
    <?php the_field('cook_time'); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Condition if field is blank’ is closed to new replies.
Skip to toolbar