This topic has 2 replies, 2 voices, and was last updated 9 years by wbz.

  • Author

    Tagged: 

  • #77211
     wbz
    Participant

    Hello,

    I have a script i want to paste in the head tag of all pages. Is there a template section i can do that to apply to current and new pages?

    Regards

    #77346
     Radu
    Moderator

    Hi,

    You can do this by adding the below code to your kleo-child/functions.php

    COPY CODE
    
    
    function kleo_adding_custom_scripts() {
        wp_register_script('my_script_name', get_stylesheet_directory_uri() . '/js/amazing_script.js', array('jquery'),'1.1', true);
        wp_enqueue_script('my_script_name');
    }
    
    add_action( 'wp_enqueue_scripts', 'kleo_adding_custom_scripts' );
    
    

    Then put your script in this location wp-content/themes/kleo-child/js/ with name amazing_script.js

    Regards

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #77352
     wbz
    Participant

    Thanks Radu, i’ll try it out.

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?