Is that possible to enqueue a script src on function.php wordpress?

I have JavaScript on my front-page-template like below, I want to remove it from the front-page-template and enqueue it on the function.php of wordpress theme, is that possible?

<script type="text/javascript" src="//shop.spreadshirt.com/shopfiles/shopclient/shopclient.nocache.js"></script>

Related posts

1 comment

  1. This should do the trick. Put this into your functions.php file.

    <?php
    
    function my_scripts() {
    
        wp_enqueue_script(
            'shop-js', '//shop.spreadshirt.com/shopfiles/shopclient/shopclient.nocache.js'
        );
    
    add_action( 'wp_enqueue_scripts', 'my_scripts' );
    

Comments are closed.