[wp-hackers] wp_register_script vs wp_enqueue_script vs <script />

Peter Westwood peter.westwood at ftwr.co.uk
Sun May 4 17:06:20 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eric Marden wrote:
|> if your script is a jquery plugin, just wp_enqueue_script('myscript',
|> 'url of your script', array('jquery')) and rest assured everything
|> will always work.
|
| and is wp_register_script basically depreciated in favor of
| wp_enqueue_script?
|

No. It depends on the complexity of your plugin/theme.

use wp_register_script if you want to enqueue the script in multiple
contexts.

You can then just call wp_enqueue_script('foo'); in the contexts that
use it - thereby reducing duplicate code.

westi
- --
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
~ C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIHe0MVPRdzag0AcURAhSIAKDNncuoxFjtSeil5isjsEYgYgpyawCdG2tj
0nZ/fIK/3hKfgtGULWZUQVA=
=dywA
-----END PGP SIGNATURE-----


More information about the wp-hackers mailing list