Support

Account

Home Forums Add-ons Repeater Field If Sub_field equals… Reply To: If Sub_field equals…

  • Unfortunately, there isn’t any easy way to do that, which is probably why it’s not documented anywhere. There have been a few questions related to this here here.

    What you have to do is loop through the fields an look to see if the value exists and base the condition on whether or not is was found. The best way to do this depends on exactly what you’re trying to do as well as where and when you want to do it.

    Let’s say that you wanted to show something extra after the loop, possibly the easiest option.

    
    $found = false;
    if (have_rows('repeater')) {
      while(have_rows('repeater')) {
        the_row();
        if (get_sub_field('sub_field') == 'the value I'm looking for') {
          $found = true;
          // possibly collect more data from this row
        }
      }
    }
    if ($found) {
      // do the extra stuff
    }