WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been searching why, but I am clueless, I cannot figure out what is happening... jQuery does not appear to be enqueued on static homepage (I am not used to work with static homepages).

On regular pages (and blog), wp_head() loads javascript files, css and stuff. On static homepage, it loads everything except javascript files (none at all), including my dear jQuery...

I just begun working on the theme, so I don't get it... It is based on a Twenty Twelve theme, so the code did not change much yet. I just touched footer.php and style.css, and I inverted sidebar & primary blocs on index.php and page.php (I am styling the sidebar horizontaly above the primary content).

If anyone has an idea, I would be glad to get some help !

share|improve this question
Please show the code that does the loading of jQuery. – kaiser Mar 13 '14 at 11:23
up vote 0 down vote accepted

If you need it everywhere, simply enqueue it from your functions.php. See the codex for ore details

function wpa_137833_scripts() {
    wp_enqueue_script( 'jquery' );
add_action( 'wp_enqueue_scripts', 'wpa_137833_scripts' );
share|improve this answer
Thanks. I though about it at first, but I assumed it would load twice the jQuery file (it does not, thank you for the suggestion), and would have prefered to understand why the scripts do not load on my static homepage, because that my come handy one day. Any Idea ? – Eva Mar 13 '14 at 12:19
The scripts only load where they are told to load. If your script isn't loading on the home page then your theme isn't enqueing it there. WordPress doesn't require jQuery on the front-end, but most themes use it. Your theme probably has a function similar to the above but it might have some conditional logic that is keeping jQuery off the static home page. If you read the Codex article you should now understand that enqueing is the proper way to load scripts, because then WordPress only prints out 1 copy of the same script on page load. – helgatheviking Mar 14 '14 at 10:04
I do know that, yes, since several years. The thing is I did not find any mention of the script's queue anywhere in functions.php and nothing explainning that it is showing up everywhere except on static homepage if my WP is using static homepage. So, the script is already enqueued somewhere for all pages except this one), I just cannot find it in the theme files (twenty twelve) and that is weird, isn't it ? Or it is using a function I do not know could load my js files... I really am feeling idiot about this. – Eva Mar 14 '14 at 14:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.