Support

Account

Home Forums General Issues Help with hiding blank field questions Reply To: Help with hiding blank field questions

  • Perhaps something like so:

    
    <?php if( !empty( get_field('birthday') ) ): ?>
        <div class="form-question">
            <?php echo 'Birthday:'; ?>
        </div> 
        <div class="form-answer">
            <?php the_field('birthday'); ?>
        </div>
    <?php endif; ?>
    

    Or maybe you need to display the .form-question divs:

    
    <div class="form-question">
        <?php echo get_field('birthday') ? 'Birthday:' : ""; ?>
    </div> 
    <div class="form-answer">
        <?php the_field('birthday'); ?>
    </div>
    

    Just in case this looks a bit strange to you, there’s a rundown on ternary logic over here.