How can I check if the WordPress code is correct?

I am trying to put a script in my WordPress theme, but I have no way to tell if this is correct. The script doesn't work, 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');

      

+3


source to share


1 answer


Your best bet is to learn how to use developer tools in Firefox (or Firebug ) or Chrome or Safari or IE to see your site's Javascript loading and any script errors.

And use Debug in WordPress https://codex.wordpress.org/Debugging_in_WordPress to check for PHP errors that may exist while using wp_enqueue_script

.



Check docs if needed for wp_enqueue_script

https://codex.wordpress.org/Function_Reference/wp_enqueue_script

+2


source







All Articles