Created
December 1, 2016 08:19
-
-
Save beovulf/5a1c26bec2eadd7bde413fc81df31771 to your computer and use it in GitHub Desktop.
If else language wordpress (polylang)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$currentlang = get_bloginfo('language'); | |
if($currentlang=="en-GB"): | |
?> | |
<?php elseif($currentlang=="pl-PL"): ?> | |
<?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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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; ?>