I'm using this code to rewrite URLs as per language (from here: [login to view URL]):
I do not want the session rules so I excluded them:
function lang_support() {
return array('en','fr'); // Add your support lang-code (1st place is a default)
}
function rewrite_lang(){
$langs = lang_support();
foreach($langs as $lang) {
add_rewrite_endpoint($lang,EP_PERMALINK|EP_PAGES|EP_ROOT|EP_CATEGORIES);
}
}
add_action('init','rewrite_lang');
function lang(){
global $wp_query;
$langs = lang_support();
$lang_r = "";
foreach($langs as $lang) {
if(isset($wp_query->query_vars[$lang])) {
$lang_r = $lang;
$_SESSION['lang'] = $lang_r;
}
}
if(in_array($lang_r,$langs)) {
return $lang_r;
} else {
return $langs[0];
}
}
It works just fine for 'en' and 'fr' but when I add more languages (i.e. 'es' and 'it' to the array it fails and brings up a random post.
Please install on your Wordpress and find out what's wrong.
Hi
I have reviewed your requirements for your preconceived project
As all your requirements are crystal clear to me so, I would like to discuss your project querries
in more detail which would let me to quote you the actual cost and suggest you more ideas over it.
We'll be providing you with our updated portfolio after you hit up with a reply
Regards,
Amaan