Support

Account

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.