[wp-hackers] Including javascript in the footer

Dion Hulse (dd32) wordpress at dd32.id.au
Wed May 11 06:37:40 UTC 2011


Trac ticket for this issue: http://core.trac.wordpress.org/ticket/9346

On 11 May 2011 16:36, John Blackbourn <johnbillion+wp at gmail.com> wrote:

> On 11 May 2011 07:32, Philip Walton <philip at philipwalton.com> wrote:
> > I've tested wp_enqueue_script() and it doesn't work if called from any
> > action after 'wp_print_scripts' in a page request.
>
> It does, but you need to coerce it a little :)
>
> In addition to setting the 'in_footer' parameter to true when you
> enqueue the script, you also need to manually call wp_print_scripts()
> within wp_footer(). I don't recall why this is the case, but I suspect
> you'll find a ticket and discussion of it on Trac if you have a search
> around.
>
> Further reading: http://scribu.net/wordpress/optimal-script-loading.html
>
> John
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list