Tagged: header
Hi there,
I want to replace the container that holds the contact telephone number in the top right corner of the header with this Google translate script, I’ve tried loads of times but it just breaks the site :(
<div class=’container’><div id=”google_translate_element”></div><script type=”text/javascript”>
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: ‘en’, layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, ‘google_translate_element’);
}
</script><script type=”text/javascript” src=”//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit”></script>
Thanks in advance…
Hi silviouk!
Please edit header.php, find this code:
$phone = avia_get_option('phone');
$phone_class = !empty($nav) ? "with_nav" : "";
if($phone) echo "<div class='phone-info {$phone_class}'><span>{$phone}</span></div>";
Replace it with:
echo '<div id="google_translate_element">';
echo "<script type='text/javascript'>
function googleTranslateElementInit() {
new google.translate.TranslateElement({pageLanguage: 'en' , layout: google.translate. TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');;
}
</script><script type='text/javascript' src='//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit'></script>
</div>";
Remove browser cache then reload the page.
Regards,
Ismael
Perfect thanks!!