Support

Account

Home Forums Add-ons Repeater Field Issue with repeater rows and conditional statement Reply To: Issue with repeater rows and conditional statement

  • The problem is that the repeater on the category still has rows. Deleting a post, category, or whatever might be in a repeater row will not remove that row from the repeater.

    Sorry, because of the way you are doing this I cannot give you code. I can only give you an idea.

    You need to loop over the first repeater and detect if any output is created, if not then do the second repeater.

    Basic example

    
    $output_created = false;
    if (have_rows('repeater')) {
      while (have_rows('repeater')) {
        the_row();
        // if you generate any content here
        $output_created = true;
        
      }
    }
    if (!$output_created) {
       // noting created in the first loop
       // do the other repeater
    }