Home Forums Add-ons Repeater Field Hide Sub Field Label and Value if empty


Hide Sub Field Label and Value if empty

    • deejr

    • June 26, 2019 at 1:38 am

    Hi I am able to hide the value of a sub field if it’s empty but cannot figure out a way of hiding both the label and the value.

    I’m using the following code which will hide the value but still shows the label.

    Any ideas would be superb

    <?php if( get_sub_field_object(‘ceiling_colour’)): ?>
    <?php $field = get_sub_field_object(‘ceiling_colour’);?>
    <p><?php echo $field[‘label’] ?>: <?php echo $field[‘value’] ?></p>
    <?php endif; ?>

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.