Support

Account

Home Forums General Issues How to build a photos and video slider Reply To: How to build a photos and video slider

  • assumptions:
    repeater field with the following sub fields
    – radio field to choose video or image
    – image field conditional on choice of radio field
    – video field conditional on choice of radio field

    This is a very basic example

    
    if (have_rows('repeater')) {
      ?>
        <div class="main-slider">
          <?php 
            while (have_rows('repeater')) {
              the_row();
              $type = get_field('radio');
              ?>
                <div class="item <?php echo $type; ?>">
                  <?php 
                    if ($type == 'image') {
                       // output image code
                    } else {
                       // output video code
                    }
                  ?>
                </div>
              <?php 
            } // end while have rows
          ?>
        </div>
      <?php 
    } // end if have rows