I am trying to enqueue a script into my WordPress theme, but i have no way to tell if it is correct. The script isn’t working, so what am i doing wrong?
function buns_bootstrap_js(){
wp_enqueue_script('bootstrapjs', get_stylesheet_directory() . 'js/bootstrap.min.js', array('jquery'),'3.2.0');
}
add_action('wp_enqueue_script', 'buns_bootstrap_js');
It’s best to learn how to use the developer tools in Firefox (or Firebug) or Chrome or Safari or IE to see the Javascript loading on your site and any script errors.
And use Debug in WordPress https://codex.wordpress.org/Debugging_in_WordPress to check for PHP errors that may exist in your use of
wp_enqueue_script
.Check the docs, if needed, for
wp_enqueue_script
https://codex.wordpress.org/Function_Reference/wp_enqueue_script