Home › Forums › Add-ons › Flexible Content Field › while ( have_rows() ) within while ( have_rows() ) …possible? › Reply To: while ( have_rows() ) within while ( have_rows() ) …possible?
You can’t create a nested loop on the same field. Honestly, I don’t know why it’s creating an endless loop, it should not be. What your doing would be similar to doing something like this
<?php
$x = 0;
while ($x<10) {
$x++;
// code here only happens once
echo 'outer loop ',$x,'<br />';
while ($x<10) {
$x++;
// code here happens 9 times
echo 'inner loop ',$x,'<br />';
}
}
?>
I can’t really tell you how to correct what you’re doing, I’d need to know more about why you are trying to nest loops on the same repeater. More than likely there is some other way to get the results you’re looking for.
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.