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 I’m still unsure how to get the actual label from that loop.

    If i call get_field(‘content_builder’); outside the “if (have rows…)’ part it gives me all all the data in that field, including rows that are not on the page, though the ‘label’ is in that array when I dump it.

    If i use it within the ‘have_rows’ and then try to do a foreach I get warnings like “Warning: Array to string conversion”

    Like if i set it up as:

    <?php if (have_rows("content_builder")) {
                while (have_rows("content_builder")) {
                    the_row();
                    $flexField = get_field("content_builder");
                    foreach ($flexField as $field) {
                        echo $field;
                        echo "<br>";
                    }
                }
            } ?>

    And if i var_dump $flexField inside the have_rows part, the label isn’t part of the array data. It seems to stay outside that loop.