Support

Account

Home Forums Add-ons Repeater Field Get specific row from options page repeater

Helping

Get specific row from options page repeater

  • I have a repeater on an options page — a list of gym trainers. I’m listing them all out, but on some pages I need to show just one specific trainer.

    Is there a way to select a specific row of a repeater?

  • Not really. You have to loop through the entire repeater and check the values to see if it’s the one you want to show, unless you know what row you want and then you can add a counter

    
    $counter == 0;
    while (have_rows('repeater')) {
      $counter++;
      if ($counter == $the_row_i_want) {
        // output row
      }
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.