I’ve been trying to load a javascript file and its not loading, looked up the docs but cant seem to figure out why it wont enqueue. Site is here : site
In the console im getting an error message for cookies, i have also disabled all plugins, recently switching the visual composer one back on but seems like jquery is not working even though i can load it fine.
Also im queueing like this right now:
function edealsdirect_scripts() {
wp_register_script( 'jquery-cookie', get_template_directory_uri() . '/vendor/js/js.cookie.js', array( 'jquery', '', false ) );
wp_enqueue_script( 'jquery-cookie' );
}
add_action( 'wp_enqueue_scripts', 'edealsdirect_scripts' );
You are registering a script and then enqueuing is as a style-sheet.
Try this (Left a snippet of how to add CSS so you can use it in future and can see the difference between them):
You are queueing style instead of script. Change wp_enqueue_style to wp_enqueue_script
Also, jquery-cookie has to be loaded after jquery. You have missing $deps argument in function call. See documentation
Try this one:
Currently on your site you are not loading the script file. I have checked if that is the correct path to the
cookie
script and it is,http://edeals.nickritson.co.uk/wp-content/themes/dragoncove-saltrock/vendor/js/js.cookie.js
.