Ecommerce Shopify WordPress Discussion

Is there a Magnific Popup function for getting images from the CMS under a certain category?

So I have a Wordpress website with a gallery of images using Advanced Custom Fields (ACF) using a repeater field with an image ID field and checkbox field for categories (see image of ACF setup in the back end below). enter image description here I then have a page called gallery, that simply lists all the categories. Now, what I would like is, when a category is clicked, show a lightbox using Magnific Popup and pull in all the images that are under that specific category in the ACF gallery in the back end. Can this be done? Thanks in advance! Here is my current code below: <section class="container"> <div id="image-gallery" class="grid col-3"> <?php if( have_rows('gallery_categories') ): while ( have_rows('gallery_categories') ) : the_row(); ?> <a class="cd-work-link image-gallery-link" data-category="<?php the_sub_field('gallery_category_value'); ?>" href="#"> <div class="work-thumb" style="background-image: url('<?php echo wp_get_attachment_image_src( get_sub_field('gallery_category_image'), "large" )[0]; ?>')"> <div class="overlay"> <div class="colour"></div> <i class="fa-solid fa-magnifying-glass caption"></i> </div> </div> <h2><?php the_sub_field('gallery_category_name'); ?></h2> </a> <?php endwhile; endif; ?> </div> </section> <div id="gallery-images" class="hidden"> <?php if( have_rows('image_gallery') ): while ( have_rows('image_gallery') ) : the_row(); ?> <a class="gallery-image" data-categories="<?php the_sub_field('gallery_image_categories'); ?>" href="<?php echo wp_get_attachment_url( get_sub_field('gallery_image_url') ); ?>"></a> <?php endwhile; endif; ?> </div> <script> jQuery(document).ready(function($) { $('.image-gallery-link').on('click', function(e) { e.preventDefault(); var category = $(this).data('category'); var images = $('.gallery-image[data-categories*="' + category + '"]'); if (images.length > 0) { var items = []; images.each(function() { var imageUrl = $(this).attr('href'); items.push(imageUrl); console.log("Added image to items array: " + imageUrl); }); console.log("Items array:", items); ${ items: items, gallery: { enabled: true }, type: 'image' }); } else { alert('No images found for this category'); } }); }); </script>
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.