- ステータス
- 開発者により解決済み
- 関連するプラグイン/テーマ
- Hestia Pro
- トピックタグ
- Compatibility
問題の概要
Hestia Proテーマの「カスタマイズ」セクションでTestimonialsを追加すると、WPML > 文字列翻訳ページでこれらがすべて1つの大きな文字列に結合されて表示されるため、個別に翻訳することが困難になります。
回避策
続行する前に、必ずサイトの完全なバックアップを作成してください。
- テーマのfunctions.phpファイルに以下のスニペットを追加します。
// WPML Workaround for compsupp-6971 function wpml_compsupp6971_translate_strings_from_hestia($original_value, $domain) { if( class_exists('Sitepress') ){ $string = $original_value; $textdomain = 'hestia-pro'; $string_name = $domain.': '.substr($string, 0, 20); $wpml_default_lang = apply_filters('wpml_default_language', NULL ); $wpml_current_lang = apply_filters( 'wpml_current_language', NULL ); if ($wpml_default_lang == $wpml_current_lang ) { do_action( 'wpml_register_single_string', $textdomain, $string_name, $string ); } // Apply the translation to the string $wpml_translation = apply_filters('wpml_translate_single_string', $string , $textdomain, $string_name); return $wpml_translation; } return $original_value; } add_filter( 'hestia_translate_single_string', 'wpml_compsupp6971_translate_strings_from_hestia', 11, 2 ); - フロントエンドでページにアクセスし、文字列を登録します。
- WPML > 文字列翻訳ページに移動し、文字列を翻訳します。