+1, I don’t see any hook to edit those labels, please add this feature.
@orest22 : What a nice hook, thanks for the share 😉
Something like that no ?
<?php if( have_rows('repeater') ): ?>
<?php while( have_rows('repeater') ): the_row(); ?>
<?php
if (get_sub_field('reusable_field')) {
foreach (get_sub_field('reusable_field') as $p) {
if( have_rows('flexible') ):
while ( have_rows('flexible') ) : the_row();
if( get_row_layout() == 'layout_flexible' ):
foreach (get_sub_field('subfields_of_layout_flexible') as $p) {
echo $p;
the_sub_field('subfieldName');
echo "<br>";
the_sub_field('subFieldName2');
}
?>
<?php elseif( get_row_layout() == 'other' ):
endif;
endwhile;
else :
endif;
}
} ?>
<?php endwhile; ?>
<?php endif; ?>
Hello,
You said your Flexible field is in a Reusable Field, so I don’t understand why you invert both in your template.
First call your Reusable field and then call your flexible field inside
Test with get_sub_field function
if (get_sub_field('reusable_field_group_for_text')) {
foreach (get_sub_field('reusable_field_group_for_text') as $p) {
echo $p;
the_sub_field('subfieldName');
the_sub_field('subFieldName2');
}
}
Yes that’s it.
But maybe it’s not the right thing to wrap a flexible field on a Reusable Field I guess.
If it doesn’t work, try to wrap the reusable into a flexible field in your repeater field.
@timh The first one only fix the issue when you want to use multiple instances of the same ACF Reusable Field on a single page.
Hi,
First, when you use a ACF Reusable Field, you have to know that you have one more imbrication in your template, so you have to do a loop with the Reusable Field to get its childs fields.
Secondly, I don’t see where you call your ACF Reusable Field in your template, you have to call it : modules_main_reusable.
Third, I encourage you to use this fork of the plugin if you want to have multiples Reusable field of an ACF Group Field in a flexible field.
https://github.com/mvpdesign/acf-reusable-field-group
Hope it helps.
Hello,
There is a fork of the plugin that fix the issue of adding n number of instances in a flexible field :
https://github.com/mvpdesign/acf-reusable-field-group
cc : @Will @shanomurphy
Hello,
Thanks for your comment. But I didn’t understood it well. What have we to do in the code ?
Good question, need that too !!
Somebody can help us please ?
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.