Support

Account

Home Forums Add-ons Repeater Field Output Repeater In Two Columns Reply To: Output Repeater In Two Columns

  • personally, I would show this in one list and float the <li> elements left. Possibly add an odd an even class so that I could add a clear left on the odd ones. This way on a really narrow screen they would still be listed in the correct order.

    As for your question, something like this

    
    if (have_rows('repeater')) {
      $column_1 = array();
      $column_2 = array();
      $count = 0;
      while (have_rows('repeater')) {
        the_row();
        if ($count % 2 == 0) {
          $column_1[] = get_sub_field('sub_field');
        } else {
          $column_2[] = get_sub_field('sub_field');
        }
        $count++;
      }
    }
    // now create your ul elements and loop through each array