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 am trying to use tips from here to add my JS file.

I put the following in the functions.php of atahualpa theme I've got installed

function lektor_init() {
  if (true) {
    wp_enqueue_script('lektor',TEMPLATEPATH.'/js/synteza.js');
  }
}
add_action('init','lektor_init'); 

TEMPLATEPATH has been already used before in there, so I just adapted it. But it doesn't show up.

What did I do wrong?

share|improve this question
    
Remember to mark the best answer as accepted. –  Arlen Beiler Aug 19 '10 at 23:10
    
Mine was first, but ok :P –  naugtur Aug 23 '10 at 10:01
add comment

3 Answers

up vote 9 down vote accepted

TEMPLATEPATH is a directory path, not a url. You'll need to use get_template_directory_uri().

share|improve this answer
add comment

if you use child themes, "template_directory" would return the parent theme directory location. I use 'CHILD_URL' and 'PARENT_URL' if you just need to print print urls.

share|improve this answer
add comment

TEMPLATEPATH was the problem. it returns full path in the filesystem with /var/www/wp/ at the beginning.

Have to get paths from get_bloginfo('template_directory')

share|improve this answer
1  
You should follow the examples as given. :-) :-) :-) BTW, be aware that template_directory doesn't work with child themes. –  MikeSchinkel Aug 19 '10 at 16:03
    
get_bloginfo('stylesheet_directory') should give the correct path though.. ;) –  t31os Nov 9 '10 at 16:59
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.