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.


In 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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.