<div class="gallery_imgs"> <?php if (have_rows('galleryitems')) : while (have_rows('galleryitems')) : the_row(); $radioCon = get_sub_field('image_or_video'); $thumImg = get_sub_field('thumbnail_img'); $video = get_sub_field('preview_video'); $result = ''; if ($radioCon == 'video') { $result = $video; } elseif ($radioCon == 'picture') { $result = $thumImg; } ?> <div class="gallery_inner"> <a class="fancybox" data-fancybox="gallery" href="<?php echo $result ?>"> <p><?php echo $result ?></p> <img src="<?php echo $thumImg; ?>" alt="<?php echo $thumImg; ?>" /> </a> </div> <?php endwhile; ?> <?php else : ?> <!--no --> <?php endif; ?>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter