For each post, there is a custom field name "Function", the key/value pair is like this:
Key : Functions
Value : <!--en-->Nourishing Yin and invigorating the vital essence of kidneys.<!--:--><!--tw-->滋陰補腎。<!--:-->
The problem is if I simply use get_post_meta , it return string of both language, how can I get the value based on the language?
I am using qTranslate right now, Thanks.
For each post, there is a custom field name "Function", the key/value pair is like this:
Key : Functions
Value : <!--en-->Nourishing Yin and invigorating the vital essence of kidneys.<!--:--><!--tw-->滋陰補腎。<!--:-->
The problem is if I simply use get_post_meta , it return string of both language, how can I get the value based on the language?
I am using qTranslate right now, Thanks.
Share Improve this question asked Jul 8, 2014 at 4:03 user3538235user3538235 1411 gold badge1 silver badge5 bronze badges1 Answer
Reset to default 1In qTranslate, there is this function that "dispatch" the language with the kind of string you have.
Haven't tested it yet, but you could do something like:
$myString = get_post_meta( $post_id, 'Functions', true);
echo qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($myMeta);
This will display the right language on your post based on the current page's language.