Support

Account

Home Forums Add-ons Repeater Field Different layout for nth rows of repeater

Helping

Different layout for nth rows of repeater

  • Hello, i am building gallery with repeater field and i want for first 5 rows to have special layout ( lets say 4 colums in bootstrap grid ) while others have 3 colums

  • 
    if (have_rows('repeater')) {
      $count = 0;
      while (have_rows('repeater')) {
        the_row();
        $class = 'col-4';
        if ($count < 3) {
          $class = 'col-3';
        }
        ?><div class="<?php echo $class; ?>">content here</div><?php 
        $count++;
      }
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Different layout for nth rows of repeater’ is closed to new replies.