I’ve found this solution from the Easy Fancybox plugin author. Put the code below at the end of the functions.php of your theme:
add_action('wp_head','my_conditional_script',0);
function my_conditional_script() {
if ( is_page('your-page-name') || is_page('your-page-name-2') ) {
remove_action('wp_enqueue_scripts', array('easyFancyBox', 'enqueue_styles'), 999);
remove_action('wp_head', array('easyFancyBox', 'main_script'), 999);
remove_action('wp_print_scripts', array('easyFancyBox', 'register_scripts'), 999);
remove_action('wp_footer', array('easyFancyBox', 'enqueue_footer_scripts'));
remove_action('wp_footer', array('easyFancyBox', 'on_ready'), 999);
}
}
-
This reply was modified 8 years, 4 months ago by
Jack All.
Hi Jack, the Easy FancyBox dev here… I normally advise against running two light box scripts on the same site simply because it makes page load times higher than they need to be. It would be best if you can find a way to use one light box script for all cases: galleries and stand-alone images (and other media?) alike.
Is there an option in Responsive Photo Gallery to disable the integrated light box? If not, then it might be worth it to find a way to use that one for single images too… Hope the dev can give you pointers on that.
And in that case, you can simply remove Easy FancyBox π
Hi RavanH,
Thanks for your support! There’s an option to disable the lightbox in the Responsive Photo Gallery that I tried earlier, but then Easy Fancybox also doesn’t pop-up.
Maybe the Photo Gallery team has a permanent fix for this.
In Photo Gallery there seems no option available to enable a lightbox on non-gallery pages. Might be a good idea for the next version π
There is an option to not load the script on non photo gallery pages, but that is not what I’m looking for.
Nevertheless I got it working with your code, so I’m happy now π
Kind regards,
Jack.
-
This reply was modified 8 years, 4 months ago by
Jack All.
-
This reply was modified 8 years, 4 months ago by
Jack All.
Hi
Thanks for sharing the solution of this problem that has been frustrating me too.
One question from a newbie:
What does “your-page-name” and “your-page-name-2” translate to in the actual WP-blog?
Hi koreff,
That is the part of the url that holds the page (or post) name of your gallery page, also called “slug” or permalink. You can see the name in Edit and Quick Edit modes in WordPress Admin.
For this page the name would be “conflict-with-fancybox-plugin-2”
Good luck,
Jack.
Hi Jack All
Thanks – Works like a charm – but does that mean that I have to add this section for EVERY gallery page, where I want to ‘short circuit’ easyFancybox?
All of the exceptions could probably be bundled together in the if-clause?
koreff
Hi Koreff,
Yes, I think you’ll have to add every page in the if clause seperated by ||.
There might also be other ways, but I am not aware of any way to identify a page containing a Responsive Photo Gallery and hook into that. You could ask the support team here.
Have a look at some of the other tips on the following Easy FancyBox support pages:
https://wordpress.org/support/topic/disable-fancybox-for-homepage/
and
https://wordpress.org/support/topic/only-load-fancy-box-js-code-css-on-one-page/
Maybe that works for you.
Regards,
Jack
Hi Jack All
OK. I use photo gallery once in a while, so I think I will just make a note to remember tweaking PHP-cod,e when these pages come along, and thus solve my problem.
Thanks again for your help
Koreff