2015-02-23 11 views
3

我有自定義後類型命名soto_property中,我已經添加了三個wp_editor爲元后,使用此代碼 -如何使自定義發佈meta wp_editor可翻譯?

wp_editor(htmlspecialchars_decode($valueeee1), 
       'propertyEditor1', 
       $settings = array('textarea_name'=>'detail', 
           'editor_class'=>'propertyEditor') 
      ); 

    wp_editor(htmlspecialchars_decode($valueeee2), 
       'propertyEditor2', 
       $settings = array('textarea_name'=>'features', 
           'editor_class'=>'propertyEditor') 
      ); 

    wp_editor(htmlspecialchars_decode($valueeee3), 
       'propertyEditor3', 
       $settings = array('textarea_name'=>'text_to_pdf', 
           'editor_class'=>'propertyEditor') 
      ); 

現在我已經安裝qtranslate插件,使我的網站多語種。該插件會自動在其默認內容編輯器中添加語言選項卡。我想在我的自定義編輯器中添加這些語言選項卡,因此它可以用定義的語言保存內容。

我該怎麼做。請幫幫我。

回答

1
add_filter('soto_property','qtrans_convertURL'); 
1

我想你需要定義可翻譯的字符串。 Check this page in codex瞭解更多詳情。

更新後的代碼應該是這樣的:

$settings = array('textarea_name'=>__('detail', 'your-text-domain'), 
        'editor_class'=>'propertyEditor') 

如果它不會爲你工作,嘗試following trick

這裏的代碼片段從最後一個環節:

if (is_admin() && function_exists("qtrans_getSortedLanguages")) { 
    add_action('admin_menu', 'enable_qTranslate_Meta'); 
} 
function enable_qTranslate_Meta() { 
    global $qtransMETA; 

    $post_types = get_post_types(); 
    /* post and page types are already processed by the plugin */ 
    $disabled_types = array('post', 'page', 'attachment', 'revision', 'nav_menu_item'); 
    $enabled_types = array_diff($post_types, $disabled_types); 

    if ($enabled_types) { 
      foreach($enabled_types as $enabled_type) { 
        add_meta_box(
          'qtrans_meta_meta_box', //HTML id 
          __('Multilingual META', 'qtranslate-meta'), //title 
          array(&$qtransMETA, 'meta_box_generate'), //callback 
          $enabled_type, //type 
          'normal', //context - normal, advanced, side 
          'high' //priority - high, low 
        ); 
      } 
    } 
} 
0

解決了!

我已經使用了qranslate-x插件,它使我的自定義wp_editor在我的自定義帖子類型頁面上可翻譯。