I am trying to register my JavaScript file in my function.php
file. But when I add in the function to load the JavaScript file, nothing happens. When I go into dev tools and inspect it on the browser, it isn't appearing there either. (I am working locally)
Here is my PHP code:
function add_scripts() {
wp_enqueue_script('scripts', get_template_directory_uri() . 'js/scripts.js', array('jquery'), '1.0.0', true);
}
add_action('wp_enqueue_scripts', 'add_scripts');
This is at the bottom of my function.php file, and the file, scripts.js is located in the js folder in my theme folder.
I should at least be seeing this load when i inspect the webpage with my dev tools, but it's not appearing. Does anyone know what might be causing this?
scripts
(first parameter) to something a little less generic (eg.my_theme_name_main_script
) and see if it helps.