0

Here is what I've done so far

in functions.php

function imk_scripts() {
    wp_enqueue_script(
        'bootstrap_js',
        get_template_directory_uri() . '/js/bootstrap.min.js',
        array('jquery'),
        '3.3.5',
        true
    );
    wp_enqueue_script(
        'plugin_js',
        get_template_directory_uri() . '/js/plugins.js',
        array(''),
        '1.0',
        true
    );
    wp_enqueue_script(
        'bskit_js',
        get_template_directory_uri() . '/js/bskit-scripts.js',
        array(''),
        '1.0',
        true
    ); 
}

add_action( 'wp_enqueue_scripts', 'imk_scripts' );

in footer.php

    <script type="text/javascript" src="<?php get_template_directory_uri(); ?>/js/bootstrap.min.js"></script>         
    <script type="text/javascript" src="<?php get_template_directory_uri(); ?>/js/plugins.js"></script>
    <script src="<?php get_template_directory_uri(); ?>/https://maps.google.com/maps/api/js?sensor=true"></script>
    <script type="text/javascript" src="<?php get_template_directory_uri(); ?>/js/bskit-scripts.js"></script>   

but the scripts are not loading... what am I doing wrong?

1
  • 1
    why are you manually inserting scripts in footer.php ? Commented Feb 9, 2016 at 7:03

1 Answer 1

1

Firstly, you don't need to add scripts in footer.php manually.

Secondly, if there are no script dependencies, you have to declare empty array:

array(), rather than array('').

Due this mistake scripts are not loading except Bootstrap.

The correct code is:

function imk_scripts() {
    wp_enqueue_script(
        'bootstrap_js',
        get_template_directory_uri() . '/js/bootstrap.min.js',
        array('jquery'),
        '3.3.5',
        true
    );
    wp_enqueue_script(
        'plugin_js',
        get_template_directory_uri() . '/js/plugins.js',
        array(),
        '1.0',
        true
    );
    wp_enqueue_script(
        'bskit_js',
        get_template_directory_uri() . '/js/bskit-scripts.js',
        array(),
        '1.0',
        true
    ); 
}
add_action( 'wp_enqueue_scripts', 'imk_scripts' );
1
  • @user21705, please let other people know that the problem is solved. To do this please mark this answer as accepted. Commented Feb 9, 2016 at 13:11

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.