164 * @param string[] $deps Optional. An array of registered script handles this script depends on. Default empty array. |
164 * @param string[] $deps Optional. An array of registered script handles this script depends on. Default empty array. |
165 * @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL |
165 * @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL |
166 * as a query string for cache busting purposes. If version is set to false, a version |
166 * as a query string for cache busting purposes. If version is set to false, a version |
167 * number is automatically added equal to current installed WordPress version. |
167 * number is automatically added equal to current installed WordPress version. |
168 * If set to null, no version is added. |
168 * If set to null, no version is added. |
169 * @param bool $in_footer Optional. Whether to enqueue the script before </body> instead of in the <head>. |
169 * @param bool $in_footer Optional. Whether to enqueue the script before `</body>` instead of in the `<head>`. |
170 * Default 'false'. |
170 * Default 'false'. |
171 * @return bool Whether the script has been registered. True on success, false on failure. |
171 * @return bool Whether the script has been registered. True on success, false on failure. |
172 */ |
172 */ |
173 function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) { |
173 function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) { |
174 _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); |
174 _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); |
338 * @param string[] $deps Optional. An array of registered script handles this script depends on. Default empty array. |
338 * @param string[] $deps Optional. An array of registered script handles this script depends on. Default empty array. |
339 * @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL |
339 * @param string|bool|null $ver Optional. String specifying script version number, if it has one, which is added to the URL |
340 * as a query string for cache busting purposes. If version is set to false, a version |
340 * as a query string for cache busting purposes. If version is set to false, a version |
341 * number is automatically added equal to current installed WordPress version. |
341 * number is automatically added equal to current installed WordPress version. |
342 * If set to null, no version is added. |
342 * If set to null, no version is added. |
343 * @param bool $in_footer Optional. Whether to enqueue the script before </body> instead of in the <head>. |
343 * @param bool $in_footer Optional. Whether to enqueue the script before `</body>` instead of in the `<head>`. |
344 * Default 'false'. |
344 * Default 'false'. |
345 */ |
345 */ |
346 function wp_enqueue_script( $handle, $src = '', $deps = array(), $ver = false, $in_footer = false ) { |
346 function wp_enqueue_script( $handle, $src = '', $deps = array(), $ver = false, $in_footer = false ) { |
347 _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); |
347 _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); |
348 |
348 |
400 } |
400 } |
401 |
401 |
402 /** |
402 /** |
403 * Add metadata to a script. |
403 * Add metadata to a script. |
404 * |
404 * |
405 * Works only if the script has already been added. |
405 * Works only if the script has already been registered. |
406 * |
406 * |
407 * Possible values for $key and $value: |
407 * Possible values for $key and $value: |
408 * 'conditional' string Comments for IE 6, lte IE 7, etc. |
408 * 'conditional' string Comments for IE 6, lte IE 7, etc. |
409 * |
409 * |
410 * @since 4.2.0 |
410 * @since 4.2.0 |