Home › Forums › Add-ons › Flexible Content Field › Flexible Content Field inside Clone Field › Reply To: Flexible Content Field inside Clone Field
The problem is that you use this to get the clone field
$callout = get_sub_field('fullscreen_callout_clone');
and then try to use this to get the show the layouts
if (have_rows('callout_content') :
while (have_rows('callout_content') : the_row()
You either need to deal with both of these using loops or array, you cannot mix them
// loops
if (have_rows('fullscreen_callout_clone')) {
while (have_rows('fullscreen_callout_clone')) {
the_row()
$color = get_sub_field('background_color');
if (have_rows('callout_content')) {
while (have_rows('callout_content')) {
the_row();
//... etc
}
}
}
}
OR
// arrays
$callout = get_sub_field('fullscreen_callout_clone');
if ($callout) {
$color = $callout['background_color'];
$layouts = $callout['callout_content'];
if ($layouts) {
foreach ($layouts as $layout) {
if ($layout['acf_fc_layout'] == 'image') {
$image = $layout['image'];
// .. etc
}
}
}
}
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.