WPML - ICL_LANGUAGE_CODE breaks my template

user3140179 picture user3140179 · Dec 27, 2013 · Viewed 7.4k times · Source

Using IF conditional with WPML should be easy but for some reason my template stops working as soon as i place following code in footer.php or everywhere else

<?php 
 if (ICL_LANGUAGE_CODE == 'en') {
     //english here
 } else {
     //other languages
 }
?>

Am I missing something?

Answer

Jonas Duerto picture Jonas Duerto · Feb 28, 2015
<?php if (ICL_LANGUAGE_CODE == 'en'): ?>
    <!-- english here -->
<?php elseif (ICL_LANGUAGE_CODE == 'es'): ?>
    <!-- spanish here -->
<?php endif; ?>
<!-- ======== Or ======= -->
<?php if (ICL_LANGUAGE_CODE == 'en'): ?>
    <!-- english here -->
<?php else: ?>
    <!-- spanish here -->
<?php endif; ?>