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?

  • @hube2 Yes no problem.

    So my page has a flexible field with 5 rows that I’m using.

    My goal is to have an in-page navigation menu with the nicename(aka label) of each of the rows with an in-page anchor link that will go to that section of the page.

    Since the pages could be changed, I can’t hardcode this, so I was hoping to set the code up to run through the rows that appear on a page, then set up links to each.

    If i use this code:

    <?php if (have_rows("content_builder")) {
        while (have_rows("content_builder")) {
            the_row();
            $flexField = get_row_layout();
            echo $flexField;
        }
    } ?>

    I get the slugs/name of each row.
    So and I know if i var_dump the main flexible field with get_field_object like:

    <?php if (have_rows("content_builder")) {
        while (have_rows("content_builder")) {
            the_row();
            $subs = get_field_object("content_builder");
            var_dump($subs);
        }
    } ?>

    i can see that the [label] fields are present in the array, “[“label”]=> string(23) “Neighbourhood: Overview”” but I cannot find a way to get it with the other row labels.

    Does that make more sense?