Tagged: x
-
AuthorPosts
-
May 1, 2016 at 7:19 pm #908339
thelistenerParticipantHi there!
My client needs to add the following script to the footer of the website I built using X and when I tried to add it to the Footer Content and the Custom Javascript areas, the Customizer wouldn’t let me save/publish it.<script type=”text/javascript”>
var google_replace_number=”(888) 280 – 4878″;
(function(a,e,c,f,g,b,d){var h={ak:”968921182″,cl:”bM8tCKj_52UQ3qCCzgM”};a[c]=a[c]||function(){(a[c].q=a[c].q||[]).push(arguments)};a[f]||(a[f]=h.ak);b=e.createElement(g);b.async=1;b.src=”//www.gstatic.com/wcm/loader.js”;d=e.getElementsByTagName(g)[0];d.parentNode.insertBefore(b,d);a._googWcmGet=function(b,d,e){a[c](2,b,h,d,null,new Date,e)}})(window,document,”_googWcmImpl”,”_googWcmAk”,”script”);
</script>Any help is appreciated.
May 2, 2016 at 12:09 am #908572
RupokMemberHi there,
Thanks for writing in! You don’t need to add the script tag to place the code within Customizer. You can try placing the raw code without script tag.
However it’s not best approach to add code to header/footer. You could add the code to your Child Theme‘s functions.php :
add_action('wp_footer', 'my_custom_footer_script', 9999); function my_custom_footer_script() { ?> <script type=”text/javascript”> var google_replace_number=”(888) 280 – 4878″; (function(a,e,c,f,g,b,d){var h={ak:”968921182″,cl:”bM8tCKj_52UQ3qCCzgM”};a[c]=a[c]||function(){(a[c].q=a[c].q||[]).push(arguments)};a[f]||(a[f]=h.ak);b=e.createElement(g);b.async=1;b.src=”//www.gstatic.com/wcm/loader.js”;d=e.getElementsByTagName(g)[0];d.parentNode.insertBefore(b,d);a._googWcmGet=function(b,d,e){a[c](2,b,h,d,null,new Date,e)}})(window,document,”_googWcmImpl”,”_googWcmAk”,”script”); </script> <?php }Replace the JS code with your code as it seems formatted as you pasted it here without code tag.
If you don’t have Child Theme and want to achieve this through plugin then you could use this – https://wordpress.org/plugins/header-and-footer-scripts/
It will help you to add your custom code to header and footer easily.
Hope this helps.
Cheers!
May 2, 2016 at 7:51 am #908998
thelistenerParticipantI used the plugin and now the script is fully viewable in the footer of the website. Isn’t it supposed to be hidden???? Also, if i want to switch to a child theme, can I export the customizer settings and import them into the child theme without issue?
May 2, 2016 at 9:02 am #909108
Paul RModeratorHi,
Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / password
– FTP credentialsDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
May 2, 2016 at 9:19 am #909129
thelistenerParticipantThis reply has been marked as private.May 2, 2016 at 12:08 pm #909408
RupokMemberHi there,
Thanks for updating. I tried to add the code in footer but it’s not visible on the footer as you mentioned. Would you clarify what you are referring? Also make sure to keep the script tag as is if you use the plugin.
If that doesn’t work then kindly follow the Child Theme procedure as suggested above as we can’t control the functionality of a third party plugin although it should work fine.
Cheers!
May 3, 2016 at 1:31 pm #911229
thelistenerParticipantRupok,
Thanks! I realized my problem was keeping the opening and closing code in the plugin. It’s working now, BUT I am now having an issue adding the following code to a html/text widget in the fourth footer area:
<a id="bbblink" class="ruvtbul" href="http://www.bbb.org/west-florida/business-reviews/attorneys/gallagher-and-hagopian-pl-in-bradenton-fl-44002311#bbbseal" title="Gallagher & Hagopian, PL, Attorneys, Bradenton, FL" style="display: block;position: relative;overflow: hidden; width: 80px; height: 144px; margin: 0px; padding: 0px;"><img style="padding: 0px; border: none;" id="bbblinkimg" src="http://seal-westflorida.bbb.org/logo/ruvtbul/gallagher-and-hagopian-pl-44002311.png" width="160" height="144" alt="Gallagher & Hagopian, PL, Attorneys, Bradenton, FL" /></a><script type="text/javascript">var bbbprotocol = ( ("https:" == document.location.protocol) ? "https://" : "http://" ); document.write(unescape("%3Cscript src='" + bbbprotocol + 'seal-westflorida.bbb.org' + unescape('%2Flogo%2Fgallagher-and-hagopian-pl-44002311.js') + "' type='text/javascript'%3E%3C/script%3E"));</script>When I press save, the icon just keeps spinning and spinning and never saves.
May 3, 2016 at 10:58 pm #911833
JadeModeratorHi there,
Would you mind letting us know where you got the code you are pasting in the customizer? The HTML part of the code is working okay but the JS seems to be causing the error which makes the customizer loads infinitely.
May 3, 2016 at 11:38 pm #911874
FriechModeratorHi There,
That code is two part, add only the HTML code on your Text Widget.
<a id="bbblink" class="ruvtbul" href="http://www.bbb.org/west-florida/business-reviews/attorneys/gallagher-and-hagopian-pl-in-bradenton-fl-44002311#bbbseal" title="Gallagher & Hagopian, PL, Attorneys, Bradenton, FL" style="display: block;position: relative;overflow: hidden; width: 80px; height: 144px; margin: 0px; padding: 0px;"><img style="padding: 0px; border: none;" id="bbblinkimg" src="http://seal-westflorida.bbb.org/logo/ruvtbul/gallagher-and-hagopian-pl-44002311.png" width="160" height="144" alt="Gallagher & Hagopian, PL, Attorneys, Bradenton, FL" /></a>And then navigate to customizer > custom > global javascript, and paste the code below:
var bbbprotocol = ( ("https:" == document.location.protocol) ? "https://" : "http://" ); document.write(unescape("%3Cscript src='" + bbbprotocol + 'seal-westflorida.bbb.org' + unescape('%2Flogo%2Fgallagher-and-hagopian-pl-44002311.js') + "' type='text/javascript'%3E%3C/script%3E"));Do not wrap it inside
<script type="text/javascript">tag. Because that code will be automatically wrap when outputted on the front-end.Hope it helps, Cheers!
May 4, 2016 at 12:06 pm #912841
thelistenerParticipantIt worked. THANK YOU!!!!!
May 4, 2016 at 4:20 pm #913254
NicoModeratorHappy to hear that.
Feel free to ask us again.
Have a great day! 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-908339 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
