Support

Account

Home Forums Add-ons Repeater Field Hide the title if the repeater's subfields are empty Reply To: Hide the title if the repeater's subfields are empty

  • No guarantees, I haven’t actually tested it. LOL 😉

    <?php
     if( have_rows('repeater_field_name') ):
      $repeater_subfield_name = get_sub_field('repeater_subfield_name');
       if( !empty($repeater_subfield_name) ):
    ?>
    <h2><?php _e('Title');?></h2> //need to hide this if subfield is empty
    <?php endif; ?>
    <ul>
    <?php while ( have_rows('repeater_field_name') ) : the_row(); ?>
    <li><?php echo $repeater_subfield_name ?></li>
    <?php endwhile; ?>
    </ul>
    <?php endif; ?>