558 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Bought between 10 and 49 items
  • Contributed a Blog Post
  • Exclusive Author
  • Germany
  • Has been a member for 4-5 years
+1 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
  • Sold between 10 000 and 50 000 dollars
  • Referred between 10 and 49 users
  • Bought between 10 and 49 items
  • Has been a member for 5-6 years
  • Exclusive Author
  • Microlancer Beta Tester
ChillThemes says

No. You should prefix everything.

120 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Referred between 10 and 49 users
  • Bought between 1 and 9 items
  • Has been a member for 0-1 years
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
  • Sold between 10 000 and 50 000 dollars
  • Has been a member for 3-4 years
  • Exclusive Author
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
  • United States
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