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

    I am installing Zopim Chat in Enfold 3.1.3 / WordPress 4.2.2.
    Zopim asks me to embed the widget code into my website HTML source code before closing the <head> tag.

    Where should I go to add this script ?
    Can you provide guidance ?

    Merci, Valentin

    #457973

    Hey valentin!

    You can find the ending head tag in the header.php file on line 53.

    If it has a widget for you to use then you could do this, http://kriesi.at/documentation/enfold/adding-a-widget-area-to-the-header/, to add a widget area to your header.

    Or you could try adding this to your child theme functions.php file to insert some code inside the header.

    add_action( 'wp_head', 'enfold_customization_custom_header' );
    function enfold_customization_custom_header() {
    // your code goes here
    }

    Best regards,
    Elliott

    #513670

    Hi Elliot

    The issue is that adding the widget area to the header doesn’t add it to the head tag area but rather the header area.

    Also the widget creates white space in the head area and can mess up the mobile display of the site regarding the top of the page. This is because this js code doesn’t render anything in the header area.

    I how ever have used the last feature you detailed which in my opinion is the best and most professional way to do it.

    I simply wrote this in my child theme functions file

    add_action(‘wp_head’,’hook_javascript’);
    function hook_javascript() {
    $output=”
    <!–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/?312fp2IpEZcc8YFgpXTxGJkMMTcy7rhb\”;z.t=+new Date;$.
    type=\”text/javascript\”;e.parentNode.insertBefore($,e)})(document,\”script\”);
    </script>
    <!–End of Zopim Live Chat Script–>
    “;
    echo $output;
    }

    The issue I have is when I view my site source code it seems the code has changed and this is what is seen in the source

    <!–Start of Zopim Live Chat Script–>
    <script type=”text/javascript”>
    window.||(function(d,s){var z==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/?312fp2IpEZcc8YFgpXTxGJkMMTcy7rhb”;z.t=+new Date;$.
    type=”text/javascript”;e.parentNode.insertBefore($,e)})(document,”script”);
    </script>
    <!–End of Zopim Live Chat Script–>

    As you can see in the first line of code the window.$zopim|| has become window.||

    Why is this and what can I do to fix this?

    #513965

    Hey!

    That code does not make sense to me. It would be best to contact whoever wrote that script for support as it doesn’t seem like a theme issue.

    Regards,
    Elliott

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.