Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #343221

    I have set up a child theme for my site. Is it possible to use the functions.php file in the child theme to insert a script into the head of each page so that when I update the parent, I do not lose the custom script within the header? I am aware that I can copy the entire header.php into the child theme, but I would prefer not to do that, so that the header can just update along with the rest of the parent theme as necessary. Thanks!

    #343312

    Hi tonyska!

    Thank you for using our theme.

    In functions.php of the child theme put the following:

    
    add_action('wp_head', 'add_my_header_script');
    
    function add_my_header_script()
    {
     echo 'your script code';
    }
    

    Best regards,
    Günter

    #346310

    thank you! that did it!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Inserting Script into Child Theme Header File using Functions’ is closed to new replies.