Enqueue never runs

My enqueue scripts are never called I can’t figure out why. All my paths are correct and I’m assuming the code is correct

Functions.php

Read More
function tim_enqueue_default_scripts() {
    if (ENVIRONMENT == 'dev') {
        $globaljs = 'global.js';
        $globalcss = 'global.css';
    }
    else {
        $globaljs = 'global-0.3.min.js';
        $globalcss = 'global-0.5.min.css';
    }
    wp_enqueue_script('globaljs', get_bloginfo('template_directory') . '/res/js/' . $globaljs . '', false, false, true);
    wp_enqueue_style('globalcss', get_bloginfo('template_directory') . '/res/css/' . $globalcss . '', false, false, true);
}
add_action('wp_enqueue_scripts', 'tim_enqueue_default_scripts');

Header.php

<?php wp_head(); ?>
</head>

Footer.php

<?php wp_footer();  ?>
</body>

Related posts

2 comments

  1. Be sure about the parameters wp_enqueue_style and wp_enqueue_script uses.(The parameters are not same for both )

    wp_enqueue_style( $handle, $src, $deps, $ver, $media );
    

    you are giving false,false,true for dependency,version and media which is a blunder mistake.If you are not sure about them, you can avoid them and if you want to following is an example

    wp_register_style( 'custom-style', 
        get_template_directory_uri() . '/css/custom-style.css', 
        array(), 'version1', 'all' );
    

    and in wp_enqueue_script you need to change $deps(dependency) parameter to array() instead of false

Comments are closed.