Here is my issue: I have an HTML template that has CSS, JS and some IMAGES attached to it. I converted it to a wordpress theme by following the very basic and simple instructions here: http://thethemefoundry.com/blog/html-wordpress/ . In order for the images to show, I have to upload them to the WP library and then change the links in the index.php and other files so they point not to /img/picture.jpg, but to http://www.sitename.com/wp-uploads/2012/11/picture.jpg.
When I do that, the pictures show just fine. However, I then try to upload the JS files to the library as well. That goes OK. Then I go and replace the links to them in the header.php file with the links that now point to the site. Just like above. However, the JS isn’t responsing at all.
Can you give me any tips on what I migth be doing wrong? I already went through all the files to see if I haven’t missed a link, but everything seems fine.
Thank you very much in advance
Your JavaScript and CSS files should not go in the Media Uploader, they should be included in your theme. From there, you can enqueue them to be included in your header using
wp_enqueue_script– http://codex.wordpress.org/Function_Reference/wp_enqueue_script – andwp_enqueue_style– http://codex.wordpress.org/Function_Reference/wp_enqueue_style.The proper way to determine the page is to use the
get_template_directory_uri()function.For example if you want to register
/wp-content/themes/YOUR_THEME/js/script.jsand it relies onjQueryyou would use this in your theme’sfunctions.php: