Created
May 16, 2018 16:31
-
-
Save tommycopeland/ed34ad73a2b6443e7fe5e888a25b926f to your computer and use it in GitHub Desktop.
Custom LOCG Intercom Launcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Intercom Functions and Styling | |
* @package locg-core-function | |
**/ | |
add_action('wp_footer', 'intercom_custom_selector'); | |
function intercom_custom_selector () { ?> | |
<html> | |
<head> | |
<style type="text/css"> | |
#locg-intercom_container { | |
position: fixed; | |
bottom: 10%; | |
right: 10%; | |
} | |
.locg-intercom_launcher { | |
position: absolute; | |
width: 60px; | |
height: 60px; | |
} | |
#intercom-container .intercom-messenger, #intercom-container .intercom-messenger-sheet { | |
bottom: 10%; | |
} | |
@media (max-width: 768px) { | |
#locg-intercom_container { | |
right: 18%; | |
} | |
} | |
@media (max-height: 375px) { | |
#locg-intercom_container { | |
bottom: 18%; | |
} | |
} | |
</style> | |
</head> | |
<body> | |
<div id="locg-intercom_container"> | |
<div class="locg-intercom_launcher"> | |
<a class="locg-intercom_open" href="mailto:[email protected]"><img src="https://www.800goldlaw.com/wp-content/uploads/img/intercom-locg_launcher_chat.png" /></a> | |
</div><!-- locg-intercom-launcher --> | |
</div><!-- locg-intercom_container --> | |
</body> | |
</html> | |
<?php } ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
window.intercomSettings = { | |
app_id: "APP_ID", // Obscured for security | |
custom_launcher_selector: ".locg-intercom_open", | |
hide_default_launcher: true, | |
}; | |
</script> | |
<script> | |
(function() { | |
var w=window; | |
var ic=w.Intercom; | |
function l() { | |
var s=d.createElement('script'); | |
s.type='text/javascript'; | |
s.async=true;s.src='https://widget.intercom.io/widget/f0i4fs0d'; | |
var x=d.getElementsByTagName('script')[0]; | |
x.parentNode.insertBefore(s,x); | |
} | |
if (typeof ic==="function") { | |
ic('reattach_activator'); | |
ic('update',intercomSettings); | |
} | |
else { | |
var d=document; | |
var i=function(){ | |
i.c(arguments) | |
}; | |
i.q=[]; | |
i.c=function(args){ | |
i.q.push(args) | |
}; | |
w.Intercom=i; | |
if(w.attachEvent){ | |
w.attachEvent('onload',l); | |
} | |
else{ | |
w.addEventListener('load',l,false); | |
} | |
} | |
}) | |
()</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment