4

I am trying to add a bootstrap js script to my WordPress theme the "right" way but I'm not seeing a link to the js file in the head section of the webpage when it loads. I tried adding it to the header of the WordPress theme the "right" way but no luck. Now I'm trying in the functions.php file and still no luck.

function buns_bootstrap_run(){
    wp_register_script('bootstrap-js', get_stylesheet_directory() . '/js/bootstrap.min.js', array('jquery'),'3.2.0', false);
    wp_enqueue_script('bootstrap-js');
}

add_action('wp_enqueue_script', 'buns_bootstrap_run');

1 Answer 1

4

The action isn't named wp_enqueue_script, but wp_enqueue_scripts

add_action('wp_enqueue_scripts', 'buns_bootstrap_run');

There's a difference between the action that's called when scripts are to be enqueued, and the function that actually enqueues them

Sign up to request clarification or add additional context in comments.

1 Comment

!!!!! My guy, your a freaking life saver!!! I tried everything, it's always the smallest things that causes problem's. Thanks a million! Now it's loading correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.