Home › Forums › Add-ons › Repeater Field › Random repeater field and limit output › Reply To: Random repeater field and limit output
Hi @Henric Åkesson
To do this, you can’t use the has_sub_field function. Instead, you need to use the more basic PHP foreach loop through the repeater field data.
This way, you can use shuffle to randomize the repeater rows, and then loop through them using a counter to break the loop at row 5.
Shuffle: http://support.advancedcustomfields.com/forums/topic/random-repeater/
limit: http://support.advancedcustomfields.com/forums/topic/limiting-results-from-repeater-field/
Good luck
Thanks
E
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.