Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #305853

    Is it possible to have all images and galleries show the same lightbox? Currently, if I have 5 images and two galleries on a page, there will be three lightboxes. One lightbox will show all of the individual images. Each gallery also gets its own lightbox. Is it possible to have just one lightbox, so clicking any image or gallery shows all of the images in the lightbox?

    #306432

    Hey davisar!

    Yes, open up wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/gallery.php and replace:

    
    $thumbs .= " <a href='".$link[0]."' data-rel='gallery-".self::$gallery."' data-prev-img='".$prev[0]."' {$class} data-onclick='{$counter}' title='".$description."' $markup_url><img {$tooltip} src='".$img[0]."' width='".$img[1]."' height='".$img[2]."'  title='".$title."' alt='".$alt."' /></a>";
    
    

    with

    
    $thumbs .= " <a href='".$link[0]."' data-rel='gallery' data-prev-img='".$prev[0]."' {$class} data-onclick='{$counter}' title='".$description."' $markup_url><img {$tooltip} src='".$img[0]."' width='".$img[1]."' height='".$img[2]."'  title='".$title."' alt='".$alt."' /></a>";
    
    

    This should link all galleries to the same lightbox.

    Cheers!
    Peter

    #306459

    Unfortunately, that didn’t work. I replaced the code, but nothing happened.

    Also, is there a way to do this with the child theme?

    #306600

    Hey!

    Thank you for the update.

    Insert a color section then place all galleries inside this section. Apply an id to it using the For Developers: Section ID field. Let’s use “gallery-section” for example. Add this on functions.php:

    function gallery_lightbox() { ?>
    <script type="text/javascript">
    jQuery(window).load(function(){
    	jQuery('#gallery-section').each(function() { // the containers for all your galleries
        jQuery(this).magnificPopup({
            delegate: 'a', // the selector for gallery item
            type: 'image',
            gallery: {
              enabled:true
            }
        });
    }); 
    });
    </script>
    <?php }
    
    add_action('wp_head', 'gallery_lightbox');

    There’s a catch to this, you need to have at least two images on a single gallery.

    Regards,
    Ismael

    #306835

    The images are in posts that don’t support color sections.

    #307200

    Hey!

    Use this code instead:

    function gallery_lightbox() { ?>
    <script type="text/javascript">
    jQuery(window).load(function(){
    jQuery('.avia-gallery').each(function() { // the containers for all your galleries
        jQuery(this).magnificPopup({
            delegate: 'a', // the selector for gallery item
            type: 'image',
            gallery: {
              enabled:true
            }
        });
    }); 
    });
    </script>
    <?php }
    
    if(is_singular('post')) add_action('wp_head', 'gallery_lightbox');

    Cheers!
    Josue

    #307357

    That didn’t work either.

    #307485

    Hi!

    I’ll cater this with the admin you provide me on the other topic.

    Cheers!
    Josue

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘lightbox’ is closed to new replies.