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
}
}
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.