Support

Account

Home Forums Add-ons Repeater Field Randomise the_row() or random repeater order in a while loop

Helping

Randomise the_row() or random repeater order in a while loop

  • Is there a way to randomise a repeater order in a while loop?

    I know you can do it with a foreach loop but i’m looking for a way to do it in a while loop. Just because of how the theme files are coded. Everytime I try to do the loop with foreach the theme files stop working, things become undeclared because everything inside the loop is using get_sub_field(‘variations’) instead of $row[‘variations].

    I know you can randomise the_post() function in wordpress so i was wondering if something similar works for the_row()

  • No, there isn’t any way to get random rows using a while loop. You must get the entire repeater and then access values in the returned array instead of using get_sub_field()

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.