Support

Account

Home Forums Add-ons Repeater Field Cant get 2 loops of 1 repeater to load

Helping

Cant get 2 loops of 1 repeater to load

    • MikeD89

    • August 29, 2019 at 12:39 am

    Seen 1 or 2 others with a similar issue, but not sure if they ever got resolved, or their solutions didnt work for me.

    Similar to others, trying to output 2 of the same loop.
    One loop to output the Tabs at the top of the page
    Second loop to output the content further down the page

    Does the first loop need to be reset? If so, how/where, and whats the correct way to do this?
    Ive seen reset_rows() mentioned often, but this simply breaks the page completely.

    if( have_rows('product_categories') ):
        while ( have_rows('product_categories') ) : the_row();
           // Loop 1 content
        endwhile;
    endif;
    
    // 2nd Loop
    if( have_rows('product_categories') ):
        while ( have_rows('product_categories') ) : the_row();
           // Loop 2 content
        endwhile;
    endif;
  • 
    if( have_rows('product_categories') ):
        while ( have_rows('product_categories') ) : the_row();
           // Loop 1 content
        endwhile;
    endif;
    
    reset_rows();
    
    // 2nd Loop
    if( have_rows('product_categories') ):
        while ( have_rows('product_categories') ) : the_row();
           // Loop 2 content
        endwhile;
    endif;
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

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.