Question

Would like to add this script on my website just on the top of the memu right side, how can i do that?

Here's the code:

    <!-- GTranslate: https://gtranslate.io/ -->

<a href="https://jimbere.org" title="French" class="glink nturl notranslate" style="float:right;"><img src="//jimbere.org/wp-content/plugins/gtranslate/flags/24/fr.png" height="24" width="24" alt="French" /></a>
<a href="https://jimbere.org/test/news" title="English" class="glink nturl notranslate" style="float:right;margin-right:3px"><img src="//jimbere.org/test/wp-content/plugins/gtranslate/flags/24/en.png" height="24" width="24" alt="English"/></a>
<a href="https://jimbere.org/test/amayagwa" title="English" class="glink nturl notranslate" style="float:right;margin-right:3px"><img src="//jimbere.org/test/wp-content/uploads/2019/04/burundi-flag-icon-32.png " height="24" width="24" alt="Kirundi"/></a>


<a href="https://jimbere.org/amayagwa" title="English" class="glink nturl notranslate" style="float:right;margin-right:3px"><img src="//jimbere.org/test/wp-content/uploads/2019/04/burundi-flag-icon-32.png"  alt="Kirundi" / style=" position: absolute;
    width: 26px;height: 19px; margin-top: 2px;right:54px"></a>



<style type="text/css">
#goog-gt-tt {display:none !important;}
.goog-te-banner-frame {display:none !important;}
.goog-te-menu-value:hover {text-decoration:none !important;}
.goog-text-highlight {background-color:transparent !important;box-shadow:none !important;}
body {top:0 !important;}
#google_translate_element2 {display:none!important;}
</style>

<div id="google_translate_element2"></div>
<script type="text/javascript">
function googleTranslateElementInit2() {new google.translate.TranslateElement({pageLanguage: 'fr',autoDisplay: false}, 'google_translate_element2');}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit2"></script>


<script type="text/javascript">
function GTranslateGetCurrentLang() {var keyValue = document['cookie'].match('(^|;) ?googtrans=([^;]*)(;|$)');return keyValue ? keyValue[2].split('/')[2] : null;}
function GTranslateFireEvent(element,event){try{if(document.createEventObject){var evt=document.createEventObject();element.fireEvent('on'+event,evt)}else{var evt=document.createEvent('HTMLEvents');evt.initEvent(event,true,true);element.dispatchEvent(evt)}}catch(e){}}
function doGTranslate(lang_pair){if(lang_pair.value)lang_pair=lang_pair.value;if(lang_pair=='')return;var lang=lang_pair.split('|')[1];if(GTranslateGetCurrentLang() == null && lang == lang_pair.split('|')[0])return;var teCombo;var sel=document.getElementsByTagName('select');for(var i=0;i<sel.length;i++)if(/goog-te-combo/.test(sel[i].className)){teCombo=sel[i];break;}if(document.getElementById('google_translate_element2')==null||document.getElementById('google_translate_element2').innerHTML.length==0||teCombo.length==0||teCombo.innerHTML.length==0){setTimeout(function(){doGTranslate(lang_pair)},500)}else{teCombo.value=lang;GTranslateFireEvent(teCombo,'change');GTranslateFireEvent(teCombo,'change')}}
</script>
Was it helpful?

Solution

First of all check where wordpress are loading your menu or where is it the file header.php with your theme active and modify with your code because sometimes the menu are loaded at header.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top