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.

I've searched high and low for the answer - the codex on wp_enqueue_script seems pretty simple.

The problem is when I add my custom excerpt script to my functions file, register and then enqueue it (set to place in header), the source is displayed in the header as:

<script src="http://www.olliedaw.co.uk/wp-content/themes/DawRefrigerationMilkTanks/js/excerpt.js" type="text/javascript">

Which looks correct in firebug, but it still comes up with a 404 error when I look at the script in firebug as if it can't find the file!

File name is right, and is in the right place but still cant get it to load???

themes/Daw Refrigeration Milk Tanks/js/excerpt.js
share|improve this question
3  
1. Having spaces in the URL makes everything more confusing, I would suggest removing the spaces from the folder name. 2. excerpt.js returns a 404 error, make sure that file is properly named and exists in that directory. –  imHavoc Nov 6 '12 at 16:21
    
You could also control the file permissions. –  hampusn Nov 6 '12 at 17:16
    
Rename your theme directory by removing spaces –  Giri Nov 6 '12 at 17:28
add comment

2 Answers

No, that's not right. Your script is located at http://www.olliedaw.co.uk/wp-content/themes/Daw%20Refrigeration%20Milk%20Tanks/js/excerpt.js and you're enqueueing http://www.olliedaw.co.uk/wp-content/themes/DawRefrigerationMilkTanks/js/excerpt.js ... those are not the same file!

This happens often when you have spaces in your file names and directories. Either remove the spaces or explicitly escape them as %20 when you queue them with wp_enqueue_script().

share|improve this answer
add comment

I would not use spaces in your path to the js file. Some older browsers will not work with spaces or even using %20.

I would recommend renaming your theme folder with dashes or underscores.

share|improve this answer
add comment

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.