How to insert Google translate into your website (WordPress)

There're two important things: 1. where to insert? 2. what's the code

In WordPress, find the Appearance, and then click Edit Themes, and then click the location you want to insert. for example: insert the language translate at the Footer. 

the codes as below:

<div id="google_translate_element"></div>

<script type="text/javascript">

function googleTranslateElementInit() {

  new google.translate.TranslateElement({pageLanguage: 'zh-TW'}, 'google_translate_element');

}

</script>

<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>


then click update now. you will get a dropdown list at the left bottom.


Tips: 

The yellowhight zh-TW code is your default language of your website,  I am using TaiWan Chinese codes. yours maybe different.

Comments

Popular posts from this blog

how to code a weather forecast web

What Build Tools Do JavaScript Developers Use?

unit3.online registration form tricks: input field box align right and placeholder text right, but input text left.

how to use :focus

Numbers in JavaScript introduction

WordPress Theme Development From Scratch - 3. Enqueuing CSS and JS to W...