Why doesn’t wp_enqueue_script() work when including a JavaScript file with TEMPLATEPATH?

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?

3 Answers
3

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

Leave a Comment