Support » Theme: Customizr » Code in the HEAD section

  • I need to insert one line of code in the HEAD section. This one:

    <script type='text/javascript' src=''></script>

    Is it possible to do it using the child theme I have created?


Viewing 7 replies - 1 through 7 (of 7 total)
  • maybe this will help

    function custom_js() {
        echo '<script type="text/javascript" src=""></script>';
    add_action('admin_head', 'custom_js');
    add_action('wp_head', 'custom_js');

    Thank you but I have added that code to the functions.php file in the child theme, I have deleted the cache, and it seems that ir is not working.

    The line of code is not in the HEAD section when I look at the web source code.

    Ok, it should work with wp_enqueue_script

    function custom_js() {
        wp_enqueue_script('myscript', '', false, '1.0' );
    add_action ('wp_enqueue_scripts','custom_js');

    It doesn´t work 🙁

    Moderator Andrew Nevins


    Forum moderator

    What do you mean by doesn’t work, is your JS file loaded in the page first?

    I just checked it on my testing site and it works, it loads the script to the head

    When I write this line in the class-header-header_main.php file (in the Customizr theme), it is shown when I look at the web source code using any browser.

    <script type='text/javascript' src=''></script>

    But I prefer not to change the Customizr theme and if I modify the functions.php in the child theme as you suggest, I can´t see that line in the web source code.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Code in the HEAD section’ is closed to new replies.