Repeater Gallery Video and image with fancybox

PHOTO EMBED

Mon Apr 15 2024 08:57:43 GMT+0000 (Coordinated Universal Time)

Saved by @hamzahanif192

<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; ?>
content_copyCOPY