例如,我有2种语言: EN 和RU:如何仅在 RU 语言中显示index.php帖子?可能是 wp_query 中的一些参数?
EN
RU
wp_query
尝试使用qtranslate核心功能
function qtrans_use($lang, $text, $show_available=false)
像这样的东西:
$mypost = get_post(get_the_ID()); $content = qtrans_use('ru', $mypost->post_content,false); echo "$content";
在qtranslate和qtranslate-x的新版本中,只能如下工作:
$postId = get_the_ID(); wp_cache_delete($postId, 'posts'); $mypost = WP_Post::get_instance($postId); $titleEn = qtrans_use('en', $mypost->post_title, false); $titleRu = qtrans_use('ru', $mypost->post_title, false); //or all object: $mypost = qtrans_use('en', $mypost, false);
查看更多相关信息(rus):https://intsystem.org/coding/qtranslate-x-vyvod-stati-v-drugom-yazyke/
2 回答
尝试使用qtranslate核心功能
像这样的东西:
在qtranslate和qtranslate-x的新版本中,只能如下工作:
查看更多相关信息(rus):https://intsystem.org/coding/qtranslate-x-vyvod-stati-v-drugom-yazyke/