I'm just wondering what is the correct way to do it? Add it in via the theme header? If so, what is the proper way to do it? I see a lot of the other current stuff in there using the bloginfo() function.

Thank You!

3 Answers 3


You could tack it into header.php as you suggested (although this is not really the proper way to do it, it is best to use WPs enqueue function as described here).

When do you need these? All the time? You can enqueue scripts and styles to be used all the time, or on an as-needed/per template basis


  • Yeah, you can enqueue each for that specific template then. It would really be the best way to do it. The links everyone provided here are excellent and should help you. An example of the code I used: wp_enqueue_style( "member_css", $voodoo_template_dir . '/scheme/member-template.css', false, "1.0", "all" ); On my members.php template only loads the member-template.css stylesheet for that template Mar 14, 2011 at 20:37
  • Since your answer has been marked as accepted, I implore you to edit it to point out that adding the scripts to the header.php file is NOT the recommended way of doing things. Mar 14, 2011 at 22:34
  • Done. Monday mornings are kinda rough, that answer wasn't worded as well as it could have been for sure.... Mar 15, 2011 at 12:13

Scribu has an excellent article on loading scripts in WordPress. Basically, if you need a script to load on every page, use the following code (blatantly copied from said article):

add_action('template_redirect', 'add_my_script');

function add_my_script() {
    wp_enqueue_script('my-script', plugins_url('my-script.js', __FILE__), '1.0', true);

(I removed the part of that snippet that expresses a dependency on jQuery). I suggest you read that whole post - it's very educational.


the right way would be using wp_enqueue_script for scripts and wp_enqueue_style for styles.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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