[wp-hackers] wp_enqueue_script() and URLs with 2+
andré renaut
andre.renaut at gmail.com
Sat Feb 28 00:53:10 GMT 2009
Hi, was just looking at your problem,
In analyzing the code of WP i found some restrictions between
wp_register_script and the WP_Scripts class (extending WP_Dependencies)
In fact, wp_register script
function wp_register_script
<http://127.0.0.1/xref27/_functions/wp_register_script.html>( $handle
<http://127.0.0.1/xref27/_variables/handle.html>, $src
<http://127.0.0.1/xref27/_variables/src.html>, $deps
<http://127.0.0.1/xref27/_variables/deps.html> = array(), $ver
<http://127.0.0.1/xref27/_variables/ver.html> = false )
is using the add function af WP_Dependencies
function add <http://127.0.0.1/xref27/_functions/add.html>( $handle
<http://127.0.0.1/xref27/_variables/handle.html>, $src
<http://127.0.0.1/xref27/_variables/src.html>, $deps
<http://127.0.0.1/xref27/_variables/deps.html> = array(), $ver
<http://127.0.0.1/xref27/_variables/ver.html> = false, $args
<http://127.0.0.1/xref27/_variables/args.html> = null )
The difference between the two is that wp_register_script do not use
the $args argument
to bypass this do as follow :
global $wp_scripts;
if ( !is_a($wp_scripts, 'WP_Scripts') )
$wp_scripts = new WP_Scripts();
$wp_scripts->add( $handle, $src, $deps, $ver, $args);
$args should be something like 'A=xxxx&B=yyy&C=zzz...'
More information about the wp-hackers
mailing list