Title: How to add plugin code to header html using function
Last modified: August 24, 2016

---

# How to add plugin code to header html using function

 *  [jenfetch](https://wordpress.org/support/users/fetchbranding/)
 * (@fetchbranding)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-to-add-plugin-code-to-header-html-using-function/)
 * How can I add this code to my header html using a function? I need to add this
   to a childtheme.
 * <!–Start of Zopim Live Chat Script–>
    <script type=”text/javascript”> window.
   $zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s= d.createElement(
   s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set. _.push(o)};z._=[];
   z.set._=[];$.async=!0;$.setAttribute(“charset”,”utf-8″); $.src=”//v2.zopim.com/?
   2viiMwgRkUnV0tYLYPgg6qcXqEgN0Gtk”;z.t=+new Date;$. type=”text/javascript”;e.parentNode.
   insertBefore($,e)})(document,”script”); </script> <!–End of Zopim Live Chat Script–
   >

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

 *  [HudsonValleyWebDesign](https://wordpress.org/support/users/jaycbrf/)
 * (@jaycbrf)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-to-add-plugin-code-to-header-html-using-function/#post-5997331)
 * Save the script in a js folder in child theme then add this to child theme’s 
   functions.php:
 *     ```
       function custom_scripts() {
       // Loads theme JavaScript file.
         wp_enqueue_script('customjs', get_template_directory_uri() . '/js/custom.js', false );
       }
       add_action('wp_enqueue_scripts', 'custom_scripts');
       ```
   
 *  [WPyogi](https://wordpress.org/support/users/wpyogi/)
 * (@wpyogi)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-to-add-plugin-code-to-header-html-using-function/#post-5997340)
 * See:
 * [https://codex.wordpress.org/Using_Javascript](https://codex.wordpress.org/Using_Javascript)
 *  [WPyogi](https://wordpress.org/support/users/wpyogi/)
 * (@wpyogi)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/how-to-add-plugin-code-to-header-html-using-function/#post-5997342)
 * BTW, are you using this plugin?
 * [https://wordpress.org/plugins/zopim-live-chat/](https://wordpress.org/plugins/zopim-live-chat/)
 * Best to ask on the support for that plugin here:
 * [https://wordpress.org/support/plugin/zopim-live-chat](https://wordpress.org/support/plugin/zopim-live-chat)

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

The topic ‘How to add plugin code to header html using function’ is closed to new
replies.

## Tags

 * [childtheme](https://wordpress.org/support/topic-tag/childtheme/)
 * [code](https://wordpress.org/support/topic-tag/code/)
 * [embed](https://wordpress.org/support/topic-tag/embed/)
 * [html](https://wordpress.org/support/topic-tag/html/)
 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [WPyogi](https://wordpress.org/support/users/wpyogi/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/how-to-add-plugin-code-to-header-html-using-function/#post-5997342)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
