Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Loading jQuery in footer - some plugins have issues #24

Closed
manwithacat opened this issue Apr 7, 2014 · 4 comments
Closed

Loading jQuery in footer - some plugins have issues #24

manwithacat opened this issue Apr 7, 2014 · 4 comments

Comments

@manwithacat
Copy link
Contributor

I've noticed a few issues with plugins that assume Wordpress will load jQuery in the header, whereas FoundationPress is enqueing in the footer.

http://wptest.io/ data includes a Videopress example that hits this problem [not core, but one of Automattic's plugins].

I've opted to return jQuery to the header by setting the last paramater on the enqueue to false (and stick in a cdn version)

wp_enqueue_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js', array(), '1.0.0', false );
@kLOsk
Copy link
Collaborator

kLOsk commented Apr 7, 2014

Hi,
It is best practice to not enqueue a newer version of JQuery than the one that ships. Also, all external scripts (on CDN) should provide a local fallback if the CDN is unreachable!

Best,

Daniel

Daniel Klose
http://www.daniel-klose.com
http://blog.daniel-klose.com

On Apr 8, 2014, at 2:40, James Barlow notifications@github.com wrote:

I've noticed a few issues with plugins that assume Wordpress will load jQuery in the header, whereas FoundationPress is enqueing in the footer.

http://wptest.io/ data includes a Videopress example that hits this problem [not core, but one of Automattic's plugins].

I've opted to return jQuery to the header by setting the last paramater on the enqueue to false (and stick in a cdn version)

wp_enqueue_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js', array(), '1.0.0', false );

Reply to this email directly or view it on GitHub.

@manwithacat
Copy link
Contributor Author

Foundation requires a newer version of jQuery than is shipped with Wordpress, so for non-admin pages you have to enqueue a new version. Foundation/FoundationPress sticks the jQuery and custom javascript at the end of the body, which is sensible, but does cause issues with some plugins that assume jQuery availability. Local fallback is handled elsewhere.

@kLOsk
Copy link
Collaborator

kLOsk commented Apr 8, 2014

Ok, thanks for the headsup!


Daniel Klose
http://www.daniel-klose.com
http://blog.daniel-klose.com

On Apr 8, 2014, at 19:18, James Barlow notifications@github.com wrote:

Foundation requires a newer version of jQuery than is shipped with Wordpress, so for non-admin pages you have to enqueue a new version. Foundation/FoundationPress sticks the jQuery and custom javascript at the end of the body, which is sensible, but does cause issues with some plugins that assume jQuery availability. Local fallback is handled elsewhere.


Reply to this email directly or view it on GitHub.

@olefredrik
Copy link
Owner

@jmbarlow 👍

All scripts are now registered and enqueued properly. jQuery are included in the header as you suggested, in order to avoid compability issues with third party plugins. See 00aa377 for more info.

Thanks for your constructive feedback!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants