• Resolved Imagedaevide

    (@daevide)


    This is inside my functions.php:

    function load_utils() {
    // Load constants.js first
    wp_enqueue_script(
    'utils',
    get_stylesheet_directory_uri() . '/js/utils.js',
    array(),
    time(),
    true
    );
    }
    add_action('wp_enqueue_scripts', 'load_utils');

    I swear to god it’s not getting loaded into the page. Or better, when I check the “Network” section while inspecting the page, there is an utils.js loaded but it’s empty (or contains only auto generated code). The directory path of the script is right, as I have another script that is loading correctly, using this code here:

    function my_custom_script() {

    wp_enqueue_script(
    'move_cat',
    get_stylesheet_directory_uri() . '/js/move_cat.js',
    array('utils'),
    filemtime(get_stylesheet_directory() . '/js/move_cat.js'),
    true
    );
    }
    add_action('wp_enqueue_scripts', 'my_custom_script');

    This second script reflects the changes I’m doing on visual studio very quick.

    What is the problem? caching? Thank you so much for your help

    • This topic was modified 6 months, 3 weeks ago by Imagedaevide.
Viewing 1 replies (of 1 total)
  • Thread Starter Imagedaevide

    (@daevide)

    Ok fixed it, basically my utils.js name was interacting with some utils.js script in the include folder, lost 2 hours for this 😭

    But we gucci now

    • This reply was modified 6 months, 3 weeks ago by Imagedaevide.
Viewing 1 replies (of 1 total)

The topic ‘Custom JS script not loading into page?’ is closed to new replies.