Support

Account

Home Forums General Issues Get Label in Repeater Field Reply To: Get Label in Repeater Field

  • Here’s a version to show both the label and value for a sub field in a repeater.

    <?php if( have_rows(‘distribution_list’) ): ?>
    <div id=”distributors”>

      <?php while( have_rows(‘distribution_list’) ): the_row();

      $select = get_sub_field_object(‘country’);
      $value = get_sub_field(‘country’);
      $label = $select[‘choices’][ $value ];

      ?>

      <li class=”<?php echo $value; ?>”><?php echo $label; ?>

      <?php endwhile; ?>

    </div>
    <?php endif; ?>