-
-
Save giorgioriccardi/213a055d115b2ae3399db978b6eafe4e 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-CA"): | |
?> | |
<?php elseif($currentlang=="fr-CA"): ?> | |
<?php endif; ?> | |
or to avoid limitations or issues with "en-CA" "en-GB" "en-US" "en-UK" "fr-FR" etc: | |
<?php if(ICL_LANGUAGE_CODE=='en'): ?> | |
<h2>I'm an English page</h2> | |
<?php elseif(ICL_LANGUAGE_CODE=='fr'): ?> | |
<h2>Je suis une page en Français</h2> | |
<?php endif; ?> | |
<!-- https://css-tricks.com/forums/topic/php-html-lang-attribute-if-statement/ --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment