[theme-reviewers] jQuery

Daniel Tara contact at onedesigns.com
Thu May 31 06:57:12 UTC 2012


A possible case-scenario comes to my mind: Now that child theme will  
be allowed in the repository with WP 3.4 coming out, child themes may  
want to deregister parent theme bulled scripts to replace them with  
their own (most probably newer versions).

There may be other scripts that depends on the registered scripts  
handle so adding the new script under the new name will just create  
more need for work-arounds, confusion and possible conflicts. My  
thought is that the old script won't be used anymore anyway so it will  
just stay there registered, along with the other scripts that required  
workarounds just for the sake of complying with a guidelines.

If it's not broken don't fix it. Just my 2 cent.

Daniel
On May 31, 2012, at 6:12 AM, Emil Uzelac wrote:

Even with multiple libraries wp_deregister_script is not needed. With  
e.g. wp_enqueue_script('my-script', get_template_directory_uri() .  
'/js/my-script.js', array('jquery'), '1.0.0', true); you can enqueue  
as many JS as you want, without conflicts, what you already know. Now  
just like PHP JS can be overridden with another e.g.  
my-custom-fancybox as well, so you don't need to deregister. This  
applies only to WPORG, you can do whatever you please on your site,  
which doesn't really apply to this topic anyways :) Quick example  
http://stackoverflow.com/questions/296667/overriding-a-javascript-function-while-referencing-the-original

Emil



On Wed, May 30, 2012 at 5:00 PM, Sayontan Sinha <sayontan at gmail.com> wrote:
My only question: is there *ever* a legitimate use of wp_deregister_script()?

I can think of one corner case, though it is really really rare. Let's  
say you are using 2 external JS libraries in your theme that don't  
work with each other out of the box (or they don't give you  
appropriate results). So you tweak them to make them work. Now, your  
tweaks are done in a manner that doesn't affect other plugins using  
unmodified versions of the script. E.g. you might have added a "data"  
attribute to something in the script. If you want the modified script  
to be picked up, you would want to deregister the one from the plugin  
and register yours. Of course, there are potential questions about  
namespacing such scripts, but those questions exist for any script  
that is not bundled with WP itself, regardless of wp_deregister_script.

I have had to modify libraries for a plugin - I couldn't get Fancybox  
/ Colorbox / PrettyPhoto to play nicely with JQuery Tooltip, so I had  
to put in some modifications. I am guessing there might be theme  
authors requiring to do something similar.

Sayontan.


On Wed, May 30, 2012 at 2:48 PM, Chip Bennett <chip at chipbennett.net> wrote:
I agree, too. I think adding wp_dereigster_script() to Theme Check  
would be a great idea. My only question: is there *ever* a legitimate  
use of wp_deregister_script()? If so, we can add it as INFO; if not,  
we can just go ahead and add it as REQUIRED. But, I want to be sure  
we've considered any unintended consequences before doing so.

Chip

On Wed, May 30, 2012 at 4:33 PM, esmi at quirm dot net <esmi at quirm.net> wrote:
on 30/05/2012 22:01 Emil Uzelac said the following:
Also see:
http://wpdevel.wordpress.com/2011/12/12/use-wp_enqueue_scripts-not-wp_print_styles-to-enqueue-scripts-and-styles-for-the-frontend/

I am *so* not arguing against any of this but it does seem to me that  
the relevant themes could be weeded out at the mandatory checks/upload  
point. I assume the Theme Check plugin is based on the mandatory  
checks, yes?


Mel
-- 
http://quirm.net
http://blackwidows.co.uk
_______________________________________________
theme-reviewers mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers


_______________________________________________
theme-reviewers mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers




-- 
Sayontan Sinha
http://mynethome.net | http://mynethome.net/blog
--
Beating Australia in Cricket is like killing a celebrity. The death  
gets more coverage than the crime.


_______________________________________________
theme-reviewers mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers


_______________________________________________
theme-reviewers mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers




More information about the theme-reviewers mailing list