Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #905977

    Hello,

    I need to add this script to the header:
    <script>
    window.CMS = true;
    </script>

    This script will be used to allow Chambermaster widgets.

    I would like to add it to my child theme so it will not get overwritten after theme updates.

    I saw a couple different solutions from the forum but started getting confused. Can you please suggest the best way to do this.

    Thanks,
    Monique

    #905980

    Hey Monique,
    Try adding this code to the end of your child theme functions.php file in Appearance > Editor:

    function add_custom_code(){
    ?>
    <script>
    window.CMS = true;
    </script>
    <?php
    }
    add_action('wp_head', 'add_custom_code');

    Best regards,
    Mike

    #905991

    That worked. Thank you!

    #906104

    Hi,

    Glad that Mike helped you. Thanks for using Enfold :)

    Best regards,
    Nikko

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Adding custom script to header using child theme’ is closed to new replies.