I understood that WordPress ALWAYS enqueues jQuery on all themes, thus it’s reduntant to enqueue another jQuery with the same version.
However, while developing a theme, for testing purposes I moved it to a subdomain (same domain, another WP installation, no content but the “Hello World” post).
While the first enqueued normally the jQuery, the second stopped some functionalities and looking inside I’ve found that WordPress was not including jQuery automatically anymore.
The question is: Does WordPress wait for something (don’t know, maybe a minimum of widgets on widget areas, menus, etc) to call the script? To make sure, do I have to enqueue the native jQuery manually? I’m developing a theme with the purpose to sell it on Theme Forest and they only allow the native WP jQuery (no way to dequeue it and add from another resource).
I’m using WordPress 3.8
On the frontend, WordPress enqueues jQuery only when the admin bar is visible, usually only for users who are logged in.
If you need jQuery, enqueue it. It will not be included twice in this case.
Do WordPress wait for something (don’t know, maybe a minimum of widgets on widget areas, menus, etc) to call the script?
No. WordPress will load the script if you tell it to using the correct method.
You would use this method for loading scripts via your child themes functions file.
Assumes your script is located in a folder named js in your child themes root directory.
For parent themes, replace:
With: