-
-
Save beovulf/5a1c26bec2eadd7bde413fc81df31771 to your computer and use it in GitHub Desktop.
<?php | |
$currentlang = get_bloginfo('language'); | |
if($currentlang=="en-GB"): | |
?> | |
<?php elseif($currentlang=="pl-PL"): ?> | |
<?php endif; ?> |
$currentlang=="en-GB" or $currentlang == "en-GB"
Nice! For me when I print_r
the $currentlang
it was All Caps, so just to be sure:
$currentlang = strtoupper(get_bloginfo('language'));
starting from your snippet I solved my issue and following this other snippet from https://css-tricks.com/forums/topic/php-html-lang-attribute-if-statement/ I ended up also solving the problem for different versions of "en-GB"," en-US", "en-CA" etc, like this:
<?php if(ICL_LANGUAGE_CODE=='en'): ?>
// do stuff
<?php elseif(ICL_LANGUAGE_CODE=='fr'): ?>
// do other stuff
<?php endif; ?>
<3 Thanks a lot!
giorgioriccardi, thank you!
Great solution! Still working :)
Thank you very much, I was looking for this so much
This helped me a lot! Thank you for sharing.
starting from your snippet I solved my issue and following this other snippet from https://css-tricks.com/forums/topic/php-html-lang-attribute-if-statement/ I ended up also solving the problem for different versions of "en-GB"," en-US", "en-CA" etc, like this:
<?php if(ICL_LANGUAGE_CODE=='en'): ?>
// do stuff
<?php elseif(ICL_LANGUAGE_CODE=='fr'): ?>
// do other stuff
<?php endif; ?>
thanks 🤝
great solution. this helped me a lot.
you beautiful bastard <3