[wp-hackers] wp_register_script() vs. wp_enqueue_script()?

Frank Bueltge frank at bueltge.de
Thu Jan 22 12:50:59 GMT 2009


http://wpengineer.com/use-javascript-libraries-in-and-of-wordpress/
maybe you understand the functions when you read this small tutorial.



On Thu, Jan 22, 2009 at 7:15 AM, Mike Schinkel
<mikeschinkel at newclarity.net>wrote:

> "Austin Matzko" <if.website at gmail.com> wrote:
> > You need the name (or the "handle") because WP_Dependencies,
> > the class behind all of this, makes sure that it doesn't
> > enqueue the same handle more than once at any given time.
>
> Thanks for the reply.
>
> So using enqueue *can* achieve the same register with the addition of also
> emitting the link into the header. If I misunderstand please let me know
> otherwise it's what I assumed would make sense.
>
> > That also answers your other question about duplicate
> > scripts: duplicates are avoided so long as the handles
> > are the same.
>
> But that would only help *if* different plugins used the same name, right?
>  So three different plugins could register "Nifty Corners"[1] respectively
>  each as the following and they would all three get included, right?
>
>   1.) wp_register_script('niftycorners', ...);
>   2.) wp_register_script('nifty-corners', ...);
>   3.) wp_register_script('nifty_corners', ...);
>
> Hence my suggestion to have a single place to list how they are used...?
>
> -Mike Schinkel
> http://mikeschinkel.com/
>
> [1] Nifty Corners found listed at http://javascriptlibraries.com/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list