Support

Account

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