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
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.