[ Index ]

WordPress Cross Reference

title

Body

[close]

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

BackPress Scripts Procedural API

File Size: 258 lines (11 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
Print scripts in document head that are in the $handles queue.

Called by admin-header.php and 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.
Makes use of already-instantiated $wp_scripts global if present. Use provided wp_print_scripts
hook to register/enqueue new scripts.

param: array|bool $handles Optional. Scripts to be printed. Default 'false'.
return: array On success, a processed array of WP_Dependencies items; otherwise, an empty array.

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

Registers a script to be linked later using the wp_enqueue_script() function.

param: string      $handle    Name of the script. Should be unique.
param: string      $src       Path to the script from the WordPress root directory. Example: '/js/myscript.js'.
param: array       $deps      Optional. An array of registered script handles this script depends on. Set to false if there
param: string|bool $ver       Optional. String specifying script version number, if it has one, which is concatenated
param: bool        $in_footer Optional. Whether to enqueue the script before </head> or before </body>.

wp_localize_script( $handle, $object_name, $l10n )   X-Ref
Localize a script.

Works only if the script has already been added.

Accepts an associative array $l10n and creates a JavaScript object:
<code>
"$object_name" = {
key: value,
key: value,
...
}
</code>

param: string $handle      Script handle the data will be attached to.
param: string $object_name Name for the JavaScript object. Passed directly, so it should be qualified JS variable.
param: array $l10n         The data itself. The data can be either a single or multi-dimensional array.
return: bool True if the script was successfully localized, false otherwise.

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

Note: there are intentional safeguards in place to prevent critical admin scripts,
such as jQuery core, from being unregistered.

param: string $handle Name of the script to be removed.

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

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

param: string      $handle    Name of the script.
param: string|bool $src       Path to the script from the root directory of WordPress. Example: '/js/myscript.js'.
param: array       $deps      An array of registered handles this script depends on. Default empty array.
param: string|bool $ver       Optional. String specifying the script version number, if it has one. This parameter
param: bool        $in_footer Optional. Whether to enqueue the script before </head> or before </body>.

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

param: string $handle Name of the script to be removed.

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

param: string $handle Name of the script.
param: string $list   Optional. Status of the script to check. Default 'enqueued'.
return: bool Whether the script script is queued.



Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu