• Resolved Marconi661

    (@marconi661)


    Have been having a problem with slider warping as it transitions. On deactivating plugins I found that Jetpack was causing the problem – in particular the Lazy Loading feature. Couldn’t find this issue reported before, is there anything I can do to have both running?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hi @marconi661

    Unfortunately this is a known issue. I’ll make a note to get this working this week and have something out for the next release. Sorry for the inconvenience.

    Hi @marconi661,

    I’m trying to reproduce the issue now but unable to. I’m using the JetPack CDN and the lazy loading feature as well. I thought this was an old issue but perhaps I addressed it already… Can you provide a link to the page in question that isnt working?

    Thread Starter Marconi661

    (@marconi661)

    Hi,

    Thanks for looking into this. See link below…

    https://1st4driving.co.uk/driving-school-in-hampshire/driving-lessons-in-portsmouth/

    • This reply was modified 5 years, 12 months ago by Marconi661.
    Thread Starter Marconi661

    (@marconi661)

    I’ve also noticed that it doesn’t seem to automatically scroll with the Lazy Load switched on. Hope this helps

    Hi @marconi661

    I think this might be a separate issue. If you check the developer console there are quite a few errors showing up that can affect how JavaScript runs on your page.

    https://prntscr.com/n7cfsl

    Can you try to disable plugins until these errors go away, then try? I don’t think this is from JetPack specifically, but perhaps another plugin breaking with JetPack (then breaking everything).

    Thread Starter Marconi661

    (@marconi661)

    Hi,

    Errors should be resolved now, problem still persisting.

    Hi @marconi661

    Can you try to add this to your theme’s functions.php file? It should disable JetPack on any MetaSlider images.

    add_action('jetpack_photon_skip_image', function ($val, $src, $tag) {
    
    	// Get an array of slideshow images
    	$slide_image_names = array_map(function ($post) {
    		$image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
    
    		// Extract the filename only from the slide image as WP will add sizes
    		return pathinfo(end(explode('/', $image)))['filename'];
    	}, get_posts(['post_type' => 'ml-slide', 'posts_per_page' => -1]));
    	
    	// Filter through every slide image and see if Jetpack is trying to serve it
    	$skip = array_filter($slide_image_names, function ($slide_src) use ($src) {
    		return strpos($src, $slide_src) !== false;
    	});
    
    	if (count($skip)) {
    		return true;
    	}
    
    	return $val;
    }, 10, 3);

    Let me know if that works.

    Thread Starter Marconi661

    (@marconi661)

    This seemed to have worked at first but the problem is still there…

    • This reply was modified 5 years, 11 months ago by Marconi661.

    Hi @marconi661,

    The issue appears to only happen on the first cycle, right? Might be the lazy loading. I’ll see if JetPack will let me disable that as well.

    Can you remove what I gave you before and use this?

    add_filter('jetpack_photon_skip_image', 'metaslider_remove_jetpack', 10, 2);
    add_filter('jetpack_lazy_images_skip_image_with_attributes', 'metaslider_remove_jetpack', 10, 2);
    function metaslider_remove_jetpack($val, $src) {
    
    	// The lazy load filter send the src as a param
    	$src = isset($src['src']) ? $src['src'] : $src;
    
    	// Get an array of slideshow images
    	$slide_image_names = array_map(function ($post) {
    		$image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
    
    		// Extract the filename only from the slide image as WP will add sizes
    		return pathinfo(end(explode('/', $image)))['filename'];
    	}, get_posts(['post_type' => 'ml-slide', 'posts_per_page' => -1]));
    
    	// Filter through every slide image and see if Jetpack is trying to serve it
    	$skip = array_filter($slide_image_names, function ($slide_src) use ($src) {
    		return strpos($src, $slide_src) !== false;
    	});
    
    	return count($skip) ? true : $val;
    }
    Thread Starter Marconi661

    (@marconi661)

    Brilliant, I’ve tested on mobile and PC and it seems to have worked. Thanks for all your help!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Conflict with Jetpack’ is closed to new replies.