WPML
ステータス
開発者により解決済み
関連するプラグイン/テーマ
BeTheme
トピックタグ
Compatibility

問題の概要

BethemeテーマとWPMLを使用しているウェブサイトでは、翻訳されたページで翻訳済みのグローバルヘッダー/フッターテンプレートが正しく表示されない場合があります。代わりに、元の言語のテンプレートが表示されます。

回避策

続行する前に、サイトの完全なバックアップを取得していることを確認してください。


  • …/wp-content/themes/betheme/functions/theme-functions.phpファイルを開きます。

  • 以下のスニペットを:
    // wpml fix
    if( defined( 'ICL_SITEPRESS_VERSION' ) ){
    	$default_lang = apply_filters('wpml_default_language', NULL );
    	$current_lang = apply_filters( 'wpml_current_language', NULL );
    	if( !empty($default_lang) && !empty($current_lang) && $current_lang != $default_lang ) $lang_postfix = '_'.$current_lang;
    }else if( function_exists( 'pll_the_languages' ) ) {
    	if( pll_default_language() != pll_current_language() ) $lang_postfix = '_'.pll_current_language();
    }

  • 次のように置き換えます。
    // wpml fix
    if( defined( 'ICL_SITEPRESS_VERSION' ) ){
    	$default_lang = apply_filters('wpml_default_language', NULL );
    	$current_lang = apply_filters( 'wpml_current_language', NULL );
    	
    	// WPML WORKAROUND FOR compsupp-7113 (we are disabling $lang_postfix)
    	if( !empty($default_lang) && !empty($current_lang) && $current_lang != $default_lang ) {
    		//$lang_postfix = '_'.$current_lang;
    	}
    }else if( function_exists( 'pll_the_languages' ) ) {
    	if( pll_default_language() != pll_current_language() ) $lang_postfix = '_'.pll_current_language();
    }

  • 次に、別のファイル…/wp-content/themes/betheme/functions.phpを開きます。

  • mfn_global()関数を:
    function mfn_global() {
        global $mfn_global;
    	
    	$mfn_global = array(
            'header' => mfn_template_part_ID('header'),
            'footer' => mfn_template_part_ID('footer'),
            'sidemenu' => mfn_global_sidemenu_id(),
            'single_product' => mfn_single_product_tmpl(),
            'blog' => mfn_archive_template_id('blog'),
            'portfolio' => mfn_archive_template_id('portfolio'),
        );
    }

  • 次のように置き換えます。
    function mfn_global() {
        global $mfn_global;
    	
        $header_global = mfn_template_part_ID('header');
    	  $header_global = apply_filters( 'wpml_object_id', $header_global, get_post_type($header_global) , TRUE  );
    
        $footer_global = mfn_template_part_ID('footer');
        $footer_global = apply_filters( 'wpml_object_id', $footer_global , get_post_type($footer_global) , TRUE  );
    
    	  $mfn_global = array(
            'header' => $header_global,
            'footer' => $footer_global,
            'sidemenu' => mfn_global_sidemenu_id(),
            'single_product' => mfn_single_product_tmpl(),
            'blog' => mfn_archive_template_id('blog'),
            'portfolio' => mfn_archive_template_id('portfolio'),
        );
    }

すべての既知の問題 →