Support

Account

Home Forums Add-ons Flexible Content Field Show all the flexible row labels used on a page? Reply To: Show all the flexible row labels used on a page?

  • I don’t think you are understanding. I have something similar. I have a flex field. Each layout has two field in it. One field is a unique ID field that is editable. This is what I use as an ID for the container for the row. The other is a label that is to be used in a link to that section. Here is the basics

    
    if (have_rows('flex_field')) {
      ?>
        <ul>
          <?php 
            while (have_rows('flex_field')) {
              the_row();
              ?><li><a href="#<?php 
                  the_sub_field('unique_id); ?>"><?php 
                  the_sub_field('link_label') ?></a></li><?php 
            }
          ?>
        </ul>
      <?php 
      reset_rows('flex_field');
      while (have_rows('flex_field')) {
        the_row();
        ?>
          <div id="<?php the_sub_field('unique_id'); ?>">
            // rest of layout code
          </div>
        <?php 
      }
    }