Hi I'm trying to use a dropdown selector to change the language of my wordpress website I'm designing, I used a simple setlanguage(); function that I did in php But the selected option on the html code won't change the url to affect the site. Is there a solution I can use to do that?
What I've tried
I've tried to add a onChange="window.location.href=this.value"
to the html
also i've tried to add some javascrip
<script type="text/javascript">
var urlmenu = document.getElementById( 'menu1' );
urlmenu.onchange = function() {
window.open( this.options[ this.selectedIndex ].value );
};
</script>
This is the dropdown html I've been [using][1] http://www.ixtendo.com/polyglot-language-switcher-jquery-plugin/
here is a [demo][2] http://www.ixtendo.com/demo/polyglot-language-switcher-jquery-plugin-2.2/index.html
The php function I've used to change the language
<?php
function setlanguage()
{
if (isset($_GET['lan']))
{
if($_GET['lan'] == 'en')
{
require_once('php/languages/en.php');
}else{
require_once('php/languages/al.php');
}
}
else{
require_once('php/languages/al.php');
}
}
setlanguage();
?>