572 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
  • Made it to the Authors' Hall of Fame
  • Had an item featured 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

709 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.

176 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
  • Sells items exclusively 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 …

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by