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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.