[theme-reviewers] jQuery

George Mamadashvili georgemamadashvili at gmail.com
Thu May 31 07:02:22 UTC 2012


I think themes shouldn't use wp_deregister_script(). In most cases it's
used for deregistering jQuery. Providing jQuery and other JS libraries from
CDN, I think is plugin territory.

On Thu, May 31, 2012 at 7:12 AM, Emil Uzelac <emil at themeid.com> 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/<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<theme-reviewers at lists.wordpress.org>
>>>> http://lists.wordpress.org/**mailman/listinfo/theme-**reviewers<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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20120531/376e0f2e/attachment.htm>


More information about the theme-reviewers mailing list