Support

Account

Home Forums Add-ons Repeater Field Show one random row from a repeater field

Helping

Show one random row from a repeater field

    • jlock

    • October 16, 2019 at 12:18 am

    Hi everybody

    I have a repeater field on my option page which contains 3 image fields.

    I am trying to make it so it returns a random row containing all the three subfields, but can’t find any examples like this, is there anyone who can help me on with this?

    Thanks

  • 
    $repater = get_field('repeater_field_name');
    $row = array_rand($repeater);
    var_dump($repeater[$row']);
    
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.