admin管理员组文章数量:1316002
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.
本文标签: pluginsHow to query the custom fields by language
版权声明:本文标题:plugins - How to query the custom fields by language? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741995445a2409948.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论