Support

Account

Home Forums Front-end Issues Trying to hide container div when fields within it have no value

Unread

Trying to hide container div when fields within it have no value

  • I am trying to hide a container div if the fields within it have no value. The fields themselves aren’t a problem. If they have no value they aren’t displayed. But if I add padding to the container div it shows up on the page. How can I hide it completely?

    Div still shows when padding is added

    Here’s my code –
    <div class=”transform-txt-block-1″ style=”background-color:aquamarine”>
    <?php if($block[‘title’]){
    echo ‘<h4 class=”h5″>’.$block[‘title’].'</h4>’;
    }
    if($block[‘short_description’]){
    echo $block[‘short_description’];
    } ?>
    </div>
    <div class=”transform-txt-block-2″ style=”background-color:bisque”>
    <?php if($block[‘title_2’]){
    echo ‘<h4 class=”h5″>’.$block[‘title_2′].'</h4>’;
    }
    if($block[‘short_description_2’]){
    echo $block[‘short_description_2’];
    } ?>
    </div>

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.