[wp-hackers] How to enqueue default scrips in footer?

Milan Dinić liste at srpski.biz
Tue Dec 29 21:16:30 UTC 2009


I never got this to work. Maybe I don't do actions as I should.
Is there any working example of this? I searched with code example from here
and didn't find anything.


2009/9/26 Andrew Ozz <admin at laptoptips.ca>

> Milan Dinić wrote:
>
>> Thank you for your answers. Tynan's approach still places it in header
>> while
>> Otto's make error (Call to a member function add_data() on a non-object in
>> ...).
>>
>
> There are actions to specifically enqueue scripts and stylesheets:
>
> http://core.trac.wordpress.org/browser/trunk/wp-includes/script-loader.php#L684
> http://core.trac.wordpress.org/browser/trunk/wp-admin/admin-header.php#L54
>
> If you really need to change the location of a default script by hand you
> could use:
>
> $wp_scripts->add_data('handle', 'group', 1 );
>
> as Otto suggested, where 1 = footer, 0 = head. This has to run after the
> scripts are added/registered but before any scripts are printed, best done
> from the above actions with priority of 11 or more.
>
> However note that scripts are moved from the footer to the head if a
> dependent script is enqueued there, forcing the default script back to the
> footer would break the dependency.
>
>
> _______________________________________________
> 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