Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #309714

    Hi,

    In Single Post Pages is it possible to have the same lightbox (group images) for featured image and gallery images in the post?

    Point would be to open featured image lightbox (e.g. a product) and then use arrows to see more images from the gallery in the post (instead of having separate lightboxes)

    Thanks

    #310149

    Hi,

    Try adding this at the very end of your theme / child theme functions.php file:

    function add_custom_script(){
    ?>
    <script>
    (function($){
    $(window).load(function() {
    $('.single-post .big-preview, .single-post .avia-gallery').magnificPopup({
    	delegate: 'a',
    	type: 'image',
    	mainClass: 'avia-popup mfp-zoom-in',
    	gallery: {
    		enabled:true
    	},
    	callbacks: {
    		imageLoadComplete: function() 
    		{	
    			var self = this;
    			setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 16);
    		}
    	}
    }); 
    });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Regards,
    Josue

    • This reply was modified 10 years, 2 months ago by Josue.
    #310158

    Cheers it’s working BUT the mfp arrows for previous-next are not displayed.
    (keyboard arrows work)

    P.S.
    also changed small typo from:
    $('.single-post big-preview, .single-post avia-gallery').magnificPopup({
    to
    $('.single-post .big-preview, .single-post .avia-gallery').magnificPopup({

    • This reply was modified 10 years, 3 months ago by Adenadoume.
    #310172

    Hi,

    Can you post the link to one of your posts please?

    Regards,
    Josue

    #310300
    #310302

    Try with this code instead:

    function add_custom_script(){
    ?>
    <script>
    (function($){
    $(window).load(function() {
    $('.single-post .big-preview, .single-post .avia-gallery').magnificPopup({
    	delegate: 'a',
    	type: 'image',
    	mainClass: 'avia-popup mfp-zoom-in',
    	gallery: {
    		enabled:true
    	},
    	callbacks: {
    		imageLoadComplete: function() 
    		{	
    			var self = this;
    			setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 16);
    		}
    	}
    }); 
    });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');
    #310309

    No arrows still don’t show

    #311249

    Hey!

    Try with this:

    function add_custom_script(){
    ?>
    <script>
    (function($){
    $(window).load(function() {
    $('.single-post .big-preview, .single-post .avia-gallery').magnificPopup({
    	delegate: 'a',
    	type: 'image',
    	mainClass: 'avia-popup mfp-zoom-in',
    	gallery: {
    		tPrev:		'',
    		tNext:		'',
    		tCounter:	'%curr% / %total%',
    		enabled:	true,
    		preload:	[1,1] // Will preload 1 - before current, and 1 after the current image
    	},
    	callbacks: {
    		imageLoadComplete: function() 
    		{	
    			var self = this;
    			setTimeout(function() { self.wrap.addClass('mfp-image-loaded'); }, 16);
    		}
    	}
    }); 
    });
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'add_custom_script');

    Cheers!
    Josue

    #311262

    Unfortunately this doesn’t work either.

    Arrows are shown only in Gallery and only if it has one than more photos inside.

    #312084

    Hi,

    Can you please create me an administrator account? post it here as a private reply.

    Regards,
    Josue

    #312191
    This reply has been marked as private.
    #313151

    Hey!

    I can’t login, the form asks for “Google Authenticator code”.

    Regards,
    Josue

    #313247
    This reply has been marked as private.
    #313614

    Hi!

    It’s working now, i had to edit loop-index.php (child) too, line 91.

    Best regards,
    Josue

    #313640

    Excellent work, exactly what was needed.

    Thanks a lot!

    #313677

    You are welcome, glad to help :)

    Regards,
    Josue

Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘Same Lightbox for Featured Image and Gallery Images’ is closed to new replies.