Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1129071

    piexec
    Participant

    I need some help fixing my theme. I broke it.

    I tried to install this script on the Functions.php page

    <script type=’text/javascript’ data-cfasync=’false’>window.purechatApi = { l: [], t: [], on: function () { this.l.push(arguments); } }; (function () { var done = false; var script = document.createElement(‘script’); script.async = true; script.type = ‘text/javascript’; script.src = ‘https://app.purechat.com/VisitorWidget/WidgetScript’; document.getElementsByTagName(‘HEAD’).item(0).appendChild(script); script.onreadystatechange = script.onload = function (e) { if (!done && (!this.readyState || this.readyState == ‘loaded’ || this.readyState == ‘complete’)) { var w = new PCWidget({c: ‘670fbe91-33dd-464d-b15c-f6076d75f86a’, f: true }); done = true; } }; })();</script>

    It didn’t work, so I tried to delete it, and now I’m getting a parse error. I don’t know what I did wrong.

    Can you help get me back up and running please!!

    Parse error: syntax error, unexpected ‘<‘ in /home/moranins/public_html/wp-content/themes/x/functions.php on line 30

    #1129072

    piexec
    Participant
    This reply has been marked as private.
    #1129307

    Darshana
    Moderator

    Hi there,

    Thanks for writing in! I have resolved your issue and your site is back online.

    Thanks!

    #1129329

    piexec
    Participant

    Thank you!

    #1129354

    piexec
    Participant

    I tried installing that script using a third party plugin, but its not recognizing it as installed. Any suggestions? It wont work at all in the Custom JS section of the theme.

    #1129685

    Friech
    Moderator

    Hi There,

    Try adding this on your child theme’s functions.php file.

    function my_custom_footer_output() { ?>
      <script type='text/javascript' data-cfasync='false'>window.purechatApi = { l: [], t: [], on: function () { this.l.push(arguments); } }; (function () { var done = false; var script = document.createElement('script'); script.async = true; script.type = 'text/javascript'; script.src = 'https://app.purechat.com/VisitorWidget/WidgetScript'; document.getElementsByTagName('HEAD').item(0).appendChild(script); script.onreadystatechange = script.onload = function (e) { if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { var w = new PCWidget({c: '670fbe91-33dd-464d-b15c-f6076d75f86a', f: true }); done = true; } }; })();</script>
     <?php }
    add_action( 'wp_footer', 'my_custom_footer_output', 99999 ); ?>

    Hope it helps, Cheers!