I am using WPML on my site and I am using the ICL_LANGUAGE_CODE==
to change what appears in one template depending on the language. At the moment if the language is english something shows, if it is any other language nothing shows. I wanted to change the logic so that the content shows in english or Spanish so I changed:
( ICL_LANGUAGE_CODE=='en' )
to:
( ICL_LANGUAGE_CODE==('en' or 'es')
.
This does not work - it prints the content for every language not just english and spanish. I tried adding the ( ICL_LANGUAGE_CODE=='es' )
as an elseif statement but that didn't do the job either. I am wondering if some of my basic syntax is wrong in the original code - see below. Any ideas about what I am doing wrong?
if ( ICL_LANGUAGE_CODE=='en' ) {?>
<?php do_action( 'tt_single_property_content_before' ); ?>
<?php echo apply_filters( 'the_content', get_post_field( 'post_content', $single_property_id ) ); ?>
<?php do_action( 'tt_single_property_content_after' ); ?>
</section>
<?php} else { }
You should change
if ( ICL_LANGUAGE_CODE=='en' ) {?>
to:
if ((ICL_LANGUAGE_CODE=='en') OR (ICL_LANGUAGE_CODE=='es')) {?>