Home › Forums › Add-ons › Repeater Field › Flexible Content & Repeater Content Showing › Reply To: Flexible Content & Repeater Content Showing
You can’t get values from the repeater inside of the loop for the nested repeater.
the_row() will actually return an array of the current row
<?php
if (have_rows('home_points')) {
while (have_rows('home_points')) {
// this will return the current repeater row in an array
$repeater_row = the_row();
// any call to the_sub_field() or get_sub_field()
// here should get sub fields of the repeater "home_points"
if (have_rows('point_column')) {
while (have_rows('point_column')) {
the_row();
// you cannot get fields from the repeater inside of the
// loop that is getting values from the nested repeater
$layout = get_row_layout();
if ($layout == 'column_header') {
the_sub_field('column_head');
} elseif ($layout == 'column_row') {
the_sub_field('another_row');
}
// use the array $repeater_row to access parent repeater row values
echo $repeater_row['brand_1'];
}
}
// any call to the_sub_field() or get_sub_field()
// here should get subfields of the repeater "home_points"
}
}
?>
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.