567 posts
  • Has referred 200+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+6 more
radykal says

Hey guys,

that is a very annoying issue and in most cases I fix it for my clients. I am using fancybox 2, but there are a lot of themes who are including fancybox 1 with another handle name for the script in the wp_enqueue_script function.

How do you handle this common issue? I just saw a plugin with fancybox 2, that renamed fancybox to fancybox2 in the code. Do you think this ia a proper solution?

Regards, Rafael

707 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+2 more
ChillThemes says

No. You should prefix everything.

145 posts
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has collected 1+ items on Envato Market
+4 more
Cubell says

These types of issues are always annoying. Authors should really work towards minimizing them. I personally have the option in the Theme Options of my themes where you can turn off the lightbox that comes with the theme and it doesn’t load the script at all if switched off.

I would recommend creating a child-theme for that theme (if it is child-theme compatible) and editing the function that loads the scripts to load yours instead. This way you don’t have to hard-edit the theme and lose the changes on every update. Good luck!

296 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Made it to the Authors' Hall of Fame
+3 more
CodeFusion says
Not a WP guru, but this sudo code may help.
In your fancybox 2 script run something like this:
wp_deregister_script('fancybox 1');
wp_register_script('fancybox 2');
wp_enqueue_script('fancybox 2');

Untested and just a though …

by
by
by
by
by
by