I’ve got a few fields on a property site, grabbing a value in English & depending on the value, translating it (if another language other than English is selected).
This piece of code works fine:
<?php if(get_post_meta($post->ID,'prop_parking',true) && $prop_parking):
$prop_parking_meta = get_post_meta($post->ID,'prop_parking',true);
if ($prop_parking_meta == 'Yes') {
$prop_parking_meta = '<!--:en-->Yes<!--:--><!--:es-->SÃ<!--:--><!--:ru-->да<!--:-->';
}
elseif ($prop_parking_meta == 'No') {
$prop_parking_meta = '<!--:en-->No<!--:--><!--:es-->No<!--:--><!--:ru-->неÑ<!--:-->';
} ?>
<li>
<p><?php echo PROP_PARK_CSTM;?>:</p><p> <?php _e( $prop_parking_meta ); ?></p>
</li>
<?php endif; ?>
I get back Yes
in the set language, yet in this field I don’t (I just see Yes
or No
):
<?php if(get_post_meta($post->ID,'prop_garage',true) && $prop_garage):
$prop_garage_meta = get_post_meta($post->ID,'prop_garage',true);
if ($prop_garage_meta == 'Yes') {
$prop_garage_meta = '<!--:en-->Yes<!--:--><!--:es-->SÃ<!--:--><!--:ru-->да<!--:-->';
}
elseif ($prop_garage_meta == 'No') {
$prop_garage_meta = '<!--:en-->No<!--:--><!--:es-->No<!--:--><!--:ru-->неÑ<!--:-->';
} ?>
<li>
<p><?php echo PROP_GARG_CSTM;?>:</p><p> <?php _e( $prop_garage_meta ); ?></p>
</li>
<?php endif; ?>
Is it something obvious I’m missing? 🙁 Thanks!
I don’t know why this issue happens sometimes in qTranslate, but there are two options to deal with it:
using the shortcode notation
applying
the_content
filter