wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_localize_script › WordPress Function

Da2.2.0
Deprecaton/a
wp_localize_script ( $handle, $object_name, $l10n )
Parametri: (3)
  • (string) $handle Script handle the data will be attached to.
    Richiesto:
  • (string) $object_name Name for the JavaScript object. Passed directly, so it should be qualified JS variable. Example: '/[a-zA-Z0-9_]+/'.
    Richiesto:
  • (array) $l10n The data itself. The data can be either a single or multi-dimensional array.
    Richiesto:
Links:
Vedi:
  • WP_Scripts::localize()
Ritorna:
  • (bool) True if the script was successfully localized, false otherwise.
Definito a:
Codex:

Localizes a script.

Works only if the script has already been registered. Accepts an associative array $l10n and creates a JavaScript object: "$object_name": { key: value, key: value, ... }


Sorgenti

function wp_localize_script( $handle, $object_name, $l10n ) {
	$wp_scripts = wp_scripts();

	return $wp_scripts->localize( $handle, $object_name, $l10n );
}