[wp-hackers] Adding javascript code after script is enqueued

Milan Dinić liste at srpski.biz
Tue Sep 15 03:37:00 UTC 2009


Is there way to add javascript code immediately after script is enqueued? I
found function wp_localize_script, but it adds code before script enqueuing.

I am asking this because of following problem. jQuery file included in
WordPress is different from official one in that it has jQuery.noConflict at
it end. If we use jQuery from Google AJAX Libraries, there is noconflict so
we need to add it.

Author of plugin Use Google Libraries (which enables use of files from
Google’s servers) solved this by enqueuing file jQnc.js (which whole content
is jQuery.noConflict(); ) . It is lightweight but it needs another request
and headers could be up to kilobyte.

It would be better if noConflict code is added in html of page, it will not
increase page size, but it will remove one request. I asked Jason could he
enable this but he said that he is not aware of way to do this with WP API.

So, does anyone knows solution for this?

Thanks


More information about the wp-hackers mailing list