Web Projects Consulting

How To Reconcile WordPress Jetpack and Easy Fancybox Plugins

When setting up the galleries from carousels with Jetpack, I have found out that switching off the galleries feature in Jetpack is not enough, and the fancybox window jumps in into the display after you close the carousel.

To fix that issue, add the below small piece of code somewhere to your theme.

jQuery(document).ready(function() {
    setTimeout(function() {
        jQuery('.gallery a.fancybox').each(function() {
            jQuery(this).removeClass('fancybox').addClass('nofancybox');
            if (jQuery(this).fancybox != undefined) {
                jQuery(this).unbind('click.fb');
                jQuery(this).fancybox = function() {};
            }
        });
    }, 50);
});

I know there are more beautiful ways of adding code to WordPress, please list them all in comments!

2 thoughts on “How To Reconcile WordPress Jetpack and Easy Fancybox Plugins

  1. Smutje Hannes

    Hey there,
    what you describe is exactly what I’m running in currently. But your fix doesn’t seem to work for me. Is there something I got to take care of or do I just copy the script in the head and it just works?

    Many thanks,
    Hannes

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.