• Resolved icey7

    (@icey7)


    Hi

    I would like to be able to display a message if a custom field is empty (has no value)

    Here is the line of code that displays the custom field

    <?php if ($arr[$i]["price"] <> '') { ?>
    <span class="tag"><span><?php echo esc_html($arr[$i]["price"]); ?></span></span>
    <?php }; ?>

    How could I make that code display the word “Sale” if the custom field price is empty?

    Looking around for 24 hours I cannot get it to work

    Thankyou for taking the time to read this

    Kind Regards

Viewing 1 replies (of 1 total)
  • Thread Starter icey7

    (@icey7)

    worked out the answer.

    <?php if ($arr[$i]["price"] <> '') { ?>
    <span class="tag"><span><?php echo esc_html($arr[$i]["price"]); ?></span></span>
    <?php } else { ?> <span class="tag"><span>Sale</span></span>
    <?php }; ?>

    thanks

    [Moderator Note: Please post code or markup snippets between backticks or use the code button.]

Viewing 1 replies (of 1 total)

The topic ‘Custom Field Issue’ is closed to new replies.