Support

Account

Home Forums Front-end Issues Hide containing div if fields are empty Reply To: Hide containing div if fields are empty

  • try it like this

    
    <?php if( have_rows('subpage_publications') ): ?>
    	    
    <div class="publications">
        <h3>Publications</h3>
        <ul>
            <?php while ( have_rows('subpage_publications') ) : the_row(); ?>
    
            <li>
                <a href="<?php the_sub_field('document'); ?>">
                    <?php the_sub_field('document_name'); ?>
                </a>
            </li>
    
            <?php endwhile; ?>
    
        </ul>
    </div>
    
    <?php endif; ?>