- ステータス
- 開発者からの返答待ち
- トピックタグ
- Compatibility
問題の概要
WPMLでeRecht24 legal texts for WordPressを使用する場合、eRecht24のショートコードやElementorウィジェット経由で追加された法的テキストが、誤った言語で表示される場合があります。これは、eRecht24のショートコードやウィジェットの設定内で言語を設定する必要があるために発生します。
ここではWPMLの言語は使用されないため、手動で翻訳を編集し、ショートコードやウィジェット内で正しい言語を選択する必要がある場合があります。
回避策
続行する前に、必ずサイトの完全なバックアップを作成してください。
- 以下のコードをテーマのfunctions.phpファイルに追加します。
// WPML - Workaround for compsupp-8368 use the shortcode_atts_{$shortcode} filter to change 'lang' to the current language or fallback to English
add_filter( 'shortcode_atts_erecht24', function ( $out, $pairs, $atts, $shortcode ) {
if ( ! class_exists( 'SitePress' ) ) {
return $out;
}
$current_lang = apply_filters( 'wpml_current_language', null );
$out['lang'] = in_array( $current_lang, array( 'de', 'en' ), true ) ? $current_lang : 'en';
return $out;
}, 10, 4 );