2013-02-23 47 views
0

我有這段代碼,得到與我的「項目描述」同名的帖子。我需要使用qtranslate動態翻譯我的文章,但它只能獲得整篇文章內容......所以我幾乎無法看到英語和其他語言。任何人都有很好的解決方案Qtranslate get_page_by_path

<?php $content_post = get_page_by_path($item->item_description, OBJECT, 'post'); 
if($content_post) 
{ 
$content = $content_post->post_content; 
echo $content; 
}?> 

我不是用PHP蚜所以請儘量將「清除」與你的答案。非常感謝你!

回答

0

我發現這個解決方案,它的工作原理但林不知道,如果它是一個相當不錯的代碼:

if($content_post) 
{ 
if(qtrans_getLanguage() == "it"){ 
$content = qtrans_use('it', $content_post->post_content,false); 
echo $content; 
}else{ 
$content = qtrans_use('en', $content_post->post_content,false); 
echo $content; 
} 
}?> 
相關問題