• Hi Folks,

    We’re using a Divi child theme.

    In the child theme’s functions.php, we have:

    function sit_divi_scripts() {
        wp_enqueue_script( 'gtm', get_stylesheet_directory_uri() . '/js/gtm.js', array(), '1.0.0', true );
    }
    add_action( 'wp_enqueue_scripts', 'sit_divi_scripts' );

    This fails to load the <script> tag on the front-end.

    When I use:

    wp_enqueue_script( 'gtm', get_template_directory_uri() ...

    the front end will load the <script> tag but it points to the parent theme directory, which is not where the script lives.

    Help appreciated.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘can’t enqueue child theme script’ is closed to new replies.