Support

Account

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

Solved

How to build a photos and video slider

  • Hi DevWeb passionate people,
    i would like to create a photos and videos slider in my wordpress website with acf and slick slider.
    i found code here
    https://gist.github.com/tommydunn/1a8e43fef57059cc5197d02890d1a886
    for the slider but a would like to dynamize it with acf.
    Someone did it before and could share me the code please or can share me a link to a tutorial

    Thank you so much for your repply

  • 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
    
  • Hi John,
    Yeah!! good i’ll try that

    thank you so much

Viewing 3 posts - 1 through 3 (of 3 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.