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 want to load some javascript for the front page of my theme after jquery and jquery ui is loaded. what would be the hook to use?

I am aware of the functions.php and I have used is_front_page(). By inserting wp_register_script in functions.php, I can queue the script after the libraries I want loaded but I also want to load it only on the frontpage. Using is_front_page() on header.php, the script gets loaded ahead of jquery.

How could I load my javascript after loading the jquery and only on the front page?

share|improve this question
I do use enqueue, but I don't want to load my script on every page. – viyyer Jan 6 '12 at 18:00
up vote 1 down vote accepted

Enqueue the script in your functions.php instead of the header, wrap it in the conditional tags ( in your case is_front_page ) and use the proper enqueue dependency, you can change the load order by altering the add_action $priority parameter or use $in_footer

share|improve this answer
thanks. great answer. – viyyer Jan 6 '12 at 18:11

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.