Reputation: 582
So, I'm trying to mess around with WordPress and I've run into a simple issue that I can't find answers to on the codex... probably 'cause its a simple fix. :)
I've got a functions.php file that is attempting to call an external js file like so:
function place_theme_scripts() {
wp_register_script( 'javascripting', get_template_directory_uri() . '/js/rspnsv.js', array(), '1.0.0', true );
wp_enqueue_script( 'javascripting');
}
add_action( 'wp_enqueue_scripts', 'place_theme_scripts' );
?>
The my 'rspnsv.js' file is under my themes directory in a file called 'js'. Seems simple enough, but this isn't working. Its not the javascript, since it runs smoothly when I place it inline. I'm clearly messing up something simple with this whole wordpress php function. Can anyone spot anything? Give me a pointer? Thanks!
Upvotes: 0
Views: 501
Reputation: 582
Hopefully, this will help those that might run into this issue. I ultimately fixed the problem by copying and pasting the codex's code example and inputting the needed file names, etc.
I still don't know what I did wrong, but I should have just copied the codex in the first place and gone from there so as to avoid any typo issues (seeing as I'm no php dev ).
Hope that helps.
Upvotes: 0
Reputation: 10240
Try using get_stylesheet_directory_uri instead of get_template_directory_uri
Upvotes: 0
Reputation: 224
one possible issue.
Upvotes: 2