Tagged: x
-
AuthorPosts
-
August 12, 2016 at 2:07 pm #1129071
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
August 12, 2016 at 2:09 pm #1129072This reply has been marked as private.August 12, 2016 at 6:06 pm #1129307Hi there,
Thanks for writing in! I have resolved your issue and your site is back online.
Thanks!
August 12, 2016 at 6:59 pm #1129329Thank you!
August 12, 2016 at 7:40 pm #1129354I 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.
August 13, 2016 at 1:56 am #1129685Hi 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!
-
AuthorPosts