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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN
— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.