wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_enqueue_script › WordPress Function
Seit2.1.0
Veraltetn/v
› wp_enqueue_script ( $handle, $src = '', $deps = array(), $ver = false, $args = array() )
Parameter: (5) |
|
Siehe: |
|
Definiert in: |
|
Codex: | |
Changelog: |
|
Enqueues a script.
Registers the script if$src
provided (does NOT overwrite), and enqueues it.Ähnliche Funktionen: wp_enqueue_scripts, wp_dequeue_script, wp_enqueue_script_module, wp_enqueue_style, wp_dequeue_script_module
Quellcode
function wp_enqueue_script( $handle, $src = '', $deps = array(), $ver = false, $args = array() ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle ); $wp_scripts = wp_scripts(); if ( $src || ! empty( $args ) ) { $_handle = explode( '?', $handle ); if ( ! is_array( $args ) ) { $args = array( 'in_footer' => (bool) $args, ); } if ( $src ) { $wp_scripts->add( $_handle[0], $src, $deps, $ver ); } if ( ! empty( $args['in_footer'] ) ) { $wp_scripts->add_data( $_handle[0], 'group', 1 ); } if ( ! empty( $args['strategy'] ) ) { $wp_scripts->add_data( $_handle[0], 'strategy', $args['strategy'] ); } } $wp_scripts->enqueue( $handle ); }