1

I am having trouble loading scripts in functions.php

I've done this before so I'm sure I'm overlooking something but as far as I can tell it is correct and I have tried copying and pasting from other answers. I am not getting any console errors. None of my scripts are loading in the source at all. Help is appreciated.

functions.php

/*SCRIPTS*/

add_action( 'wp_enqueue_scripts', 'theme_js' );

function theme_js(){

    wp_register_script( 'bootstrap_min_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true );

    wp_enqueue_script( 'bootstrap_min_js' );
}
  • 1
    What exactly isn’t working? Is the script tag not appearing at all on the page? Are you using a child theme? – Jacob Peattie Aug 1 '18 at 15:03
  • The script doesn't load at all. I'm not sure what a child theme is, I code my themes from scratch so I don't believe so. – user5854648 Aug 1 '18 at 15:37
  • When you say it doesn't load, what exactly do you mean? The script isn't doing what you want? There's an error in the console? The <script> tag isn't in the source at all? – Jacob Peattie Aug 1 '18 at 15:41
  • In my question I included I am not receiving console errors, I will edit it to specify the script tag is not in the source at all. – user5854648 Aug 1 '18 at 15:45
  • 1
    Does your theme have wp_head() and wp_footer() in it? – Jacob Peattie Aug 1 '18 at 15:47
1

I was missing the <?php wp_footer(); ?> call at the end of the footer.php file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.