Support community for TTG plugins and products.
NOTICE
The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.
This forum is now closed, and exists here as a read-only archive.
You are not logged in.
Pages: 1
I need to insert the following scripts between the <head> tags.
Can this be done via phplugins?
If so, how please?
<!--Start of Facebook Script-->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!--End of Facebook Script-->
<!--Start of Zopim Live Chat Script-->
<script type="text/javascript">
var ua = navigator.userAgent.toLowerCase(),
platform = navigator.platform.toLowerCase();
platformName = ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || platform.match(/mac|win|linux/) || ['other'])[0],
isMobile = /ios|android|webos/.test(platformName);
if (!isMobile) {
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/?7CTG7YLVUZLPWXRWbqHONqW5w8SCibXQ';z.t=+new Date;$.
type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script');
}
</script>
<!--End of Zopim Live Chat Script-->
<!--Start of Facebook Pixel-->
<script>(function() {
var _fbq = window._fbq || (window._fbq = []);
if (!_fbq.loaded) {
var fbds = document.createElement('script');
fbds.async = true;
fbds.src = '//connect.facebook.net/en_US/fbds.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;
}
_fbq.push(['addPixelId', 'XXXXXXXXXXXXXX']);
})();
window._fbq = window._fbq || [];
window._fbq.push(['track', 'PixelInitialized', {}]);
</script>
<noscript><img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?id=XXXXXXXXXXXXXX&ev=NoScript" /></noscript>
<!--End of Facebook Pixel-->
Offline
use the ttg_head_end hook:
http://ce4.theturninggate.net/docs/doku … g_head_end
This is also the place where you'd add a link to a custom css stylesheet so you can use the basic instructions, and instead of the link to the css, use your script.
http://ce4.theturninggate.net/docs/doku … custom_css
since you'll need to use echo ' you're also going to need to escape all single quotes in the script (otherwise, the first single quote will close the echo statement and probably break your site). Do that by adding a backslash before all single quotes: \'
Alternatively, you could replace single quotes with double quotes. The easiest way to do either of these things is to place all that text in a plain text editor and then run a find/replace on single quotes.
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
Pages: 1