[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> functions.wp-scripts.php (summary)

BackPress script procedural API.

File Size: 188 lines (7 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 7 functions

  wp_print_scripts()
  wp_register_script()
  wp_localize_script()
  wp_deregister_script()
  wp_enqueue_script()
  wp_dequeue_script()
  wp_script_is()

Functions
Functions that are not part of a class:

wp_print_scripts( $handles = false )   X-Ref
Prints script tags in document head.

Called by admin-header.php and by wp_head hook. Since it is called by wp_head
on every page load, the function does not instantiate the WP_Scripts object
unless script names are explicitly passed. Does make use of already
instantiated $wp_scripts if present. Use provided wp_print_scripts hook to
register/enqueue new scripts.


wp_register_script( $handle, $src, $deps = array()   X-Ref
Register new Javascript file.

param: string $handle Script name
param: string $src Script url
param: array $deps (optional) Array of script names on which this script depends
param: string|bool $ver (optional) Script version (used for cache busting), set to null to disable
param: bool $in_footer (optional) Whether to enqueue the script before </head> or before </body>
return: null

wp_localize_script( $handle, $object_name, $l10n )   X-Ref
Wrapper for $wp_scripts->localize().

Used to localizes a script.
Works only if the script has already been added.
Accepts an associative array $l10n and creates JS object:
"$object_name" = {
key: value,
key: value,
...
}
See http://core.trac.wordpress.org/ticket/11520 for more information.

param: string $handle The script handle that was registered or used in script-loader
param: string $object_name Name for the created JS object. This is passed directly so it should be qualified JS variable /[a-zA-Z0-9_]+/
param: array $l10n Associative PHP array containing the translated strings. HTML entities will be converted and the array will be JSON encoded.
return: bool Whether the localization was added successfully.

wp_deregister_script( $handle )   X-Ref
Remove a registered script.


wp_enqueue_script( $handle, $src = false, $deps = array()   X-Ref
Enqueues script.

Registers the script if src provided (does NOT overwrite) and enqueues.


wp_dequeue_script( $handle )   X-Ref
Remove an enqueued script.


wp_script_is( $handle, $list = 'queue' )   X-Ref
Check whether script has been added to WordPress Scripts.

The values for list defaults to 'queue', which is the same as enqueue for
scripts.

param: string $handle Handle used to add script.
param: string $list Optional, defaults to 'queue'. Others values are 'registered', 'queue', 'done', 'to_do'
return: bool



Generated: Fri May 25 03:56:23 2012 Hosted by follow the white rabbit.