Support

Account

Home Forums Front-end Issues Hide Empty Fields on Posts Reply To: Hide Empty Fields on Posts

  • The layout is a matter for CSS. It looks like this is supposed to be a list of some kind, so mark it up as such with HTML:

    
    <!– Begin Custom Fields –>
    <ul class="amenities">
    <?php if ( get_field(‘kitchen’ ) ) : ?>
    <li><?php the_field(‘kitchen’); ?></li>
    <?php endif; ?>
    <?php if ( get_field(‘air_conditioning’ ) ) : ?>
    <li><?php the_field(‘air_conditioning’); ?></li>
    <?php endif; ?>
    <?php if ( get_field(‘dishwasher’ ) ) : ?>
    <li><?php the_field(‘dishwasher’); ?></li>
    <?php endif; ?>
    …
    …
    <?php if ( get_field(‘handicap_friendly’ ) ) : ?>
    <li><?php the_field(‘handicap_friendly’); ?></li>
    <?php endif; ?>
    </ul>
    <!– /End Custom Fields –>
    

    … and then use CSS to lay it out the way you like. For a list displayed in multiple columns you can use the columns CSS module.