Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

It might be the simplest question but I can't find why my JavaScript files and images are not recognized by WordPress. I put all my JS files and images in my theme's folder, so I created a folder "word" inside "theme", with all the content and then I added my files. But the website doesn't recognize the path to the JavaScript or the images. Could you please tell me what i'm doing wrong?

I used it like that in the header page :

<script src="jquery.js" type="text/javascript"></script>
share|improve this question

1 Answer 1

up vote 4 down vote accepted

You need to give the full path to your theme files. To get the URL of your theme, use the WordPress function bloginfo( 'template_directory' ); so at a minimum you would need:

<script src="<?php bloginfo( 'template_directory' ) ?>/jquery.js" type="text/javascript"></script>

However, scripts / styles should really be "enqueued" using wp_enqueue_script(); (see http://codex.wordpress.org/Function_Reference/wp_enqueue_script)

I would recommend taking a look at some other themes to see how they include thetheme files like this. Also the Codex page on Theme Development is a good place to start: http://codex.wordpress.org/Theme_Development

share|improve this answer
    
Thanks !! it works well now, thanks a lot! –  Paul_p May 31 '11 at 16:01

Your Answer

 
discard

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.