I have created my own theme, pretty much from scratch, using Bootstrap 3.x. If just refer to the scripts from my footer.php file, it works. However, if I try to do it the right way, using wp_register_script, followed by wp_enqueue_script. The only thing I get loaded is the bootstrap.js script. My code is here:


 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.

function wpbootstrap_scripts_with_jquery()
    // Register the script like this for a theme:
    wp_register_script('bootstrap-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.min.js', array('jquery'), 20140902, true);
    // For either a plugin or a theme, you can enqueue the script:

    wp_register_script('custom-script', get_template_directory_uri() . '/bootstrap/js/custom.js', array('bootstrap-script', 'jquery'), 20140902, true);
    // For either a plugin or a theme, you can enqueue the script:

    wp_register_script('respond', get_template_directory_uri() . '/bootstrap/js/respond.js');

add_action('wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery');

It is very short. Also, at the risk of sounding naive, how is the functions.php inside my theme being called? Is it just automatically called if it exists in a theme directory? I'm not getting not found errors in the console, I'm just seeing that only bootstrap.js or bootstrap.min.js is being loaded and nothing else. The files are there in the right place. I know that because when I just call them using wp functions like get_stylesheet_dir() to use in a script tag in footer.php, all works fine. Thanks, Bruce

  • Please fix your question and include all necessary code. Do not link to outside code as those links can vanish. – kaiser Sep 3 '14 at 0:41
  • you don't have any caching plugin activated, right? – Tomás Cot Sep 3 '14 at 1:43
  • does your theme have the wp_footer() function to output the scripts? – Milo Jan 1 '17 at 17:05

Your Answer

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

Browse other questions tagged or ask your own question.