how to change the lang=" " dynamically for multi-language sites
Permalink 1 user found helpful
I'm having number of multi-language sites, for that i need different languages which should be place in <html lang=' '>. It should be achieved without plugin. Through php hardcode i need. Can anyone please tell me how I could make this work?
Sorry, I'm not good at php. can u please be more specific?
I got the answer...
$current_domain = $_SERVER['SERVER_NAME']; $Meta='{ "example.com": "en_us", "example.es": "es", "example.com.br": "br", "example.nl":"nl" }'; $domains = json_decode($Meta, true); $lang = null; foreach ($domains as $k => $v) { if ($k == $current_domain) { $lang = $v; break; } }
Viewing 15 lines of 16 lines. View entire code block.
You can use something like this code example: