This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Our next available supporter will start replying to tickets in about 4.87 hours from now. Thank you for your understanding.

This topic contains 3 replies, has 2 voices.

Last updated by ooluja 8 years, 4 months ago.

Author Posts
May 13, 2011 at 12:17 pm #27898

ooluja

Me again 🙂
Is there a way to translate custom field value?
My custom field: ("kat" which means "floor")
hidden link
So, if I choose the value "Prizemlje" on default language post (Croatian), how to translate this field in other languages with the "copy to translation" set, example: "Prizemlje" in Croatian means "Ground floor" in English, so I need to have this value translated automatically, if I choose "Prizemlje". Is there a way to achieve this with some IF statements in the PHP file, or, is there an easier way to do this?
Thx in advance! 🙂

May 13, 2011 at 2:07 pm #27900

ooluja

Found a way with "if" and "elseif" statements in the theme files. If there's an easier way, I would really like to know 🙂

May 13, 2011 at 2:08 pm #27901

Amir
Supporter

In order to make custom fields appear in the translation, go to WPML->Translation Management->Multilingual content setup. Choose 'translate' for that custom field.
WPML will collect the current value, when you send to translation, and will let the translator enter the translation.
If it's set to 'copy', WPML will not show it in the editor. Instead, it will duplicate the value from the original language onto the translation.

May 13, 2011 at 2:14 pm #27902

ooluja

I thought there's an easier way, but nevermind, solved it with IF statements directly in the theme file like this:
<pre>

<?php if ($property_kat == '0') { echo ''; }
                elseif($property_kat == 'Prizemlje') { echo '
<li><span class="webref">'?> <?php _e('Kat: ','domain'); ?> <?php echo '<span class="vrijednost">';?> <?php _e('Prizemlje','domain');?><?php '</li>
'; }
                elseif($property_kat == '1.') { echo '
<li><span class="webref">'?> <?php _e('Kat: ','domain'); ?> <?php echo '<span class="vrijednost">'?> <?php _e('1.','domain');?><?php '</li>
'; } ?>

</pre>

The topic ‘[Closed] Custom field translation’ is closed to new replies.