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

問題の概要

WPMLとWooCommerceでSalientテーマを使用する場合、翻訳された商品カテゴリーページにカテゴリーヘッダー画像が表示されません。これは、元のカテゴリーに割り当てられた画像が翻訳に自動的にコピーまたは表示されないためです。

回避策

続行する前に、必ずサイトの完全なバックアップを作成してください。


  • …wp-content/themes/salient/nectar/helpers/page-header.phpファイルを開きます。

  • 151行目を探します。

  • 次を:
    // Woocommerce archives.
    if( is_product_category() || is_product_tag() || is_product_taxonomy() ) {
    
    	$subtitle 			= '';
    	$title 					= woocommerce_page_title(false);
    	$cate 					= get_queried_object();
    	$t_id 					= (property_exists($cate, 'term_id')) ? $cate->term_id : '';
    	$product_terms 	= get_option( "taxonomy_$t_id" );
    	$bg 						= (!empty($product_terms['product_category_image'])) ? $product_terms['product_category_image'] : $bg;
            


  • 次のように置き換えます:
    // Woocommerce archives.
    if( is_product_category() || is_product_tag() || is_product_taxonomy() ) {
    
    	$subtitle 			= '';
    	$title 					= woocommerce_page_title(false);
    	$cate 					= get_queried_object();
    	$t_id 					= (property_exists($cate, 'term_id')) ? $cate->term_id : '';
    	// WPML Workaround for compsupp-7882
    	if ( class_exists('Sitepress') ) { 
    		$default_lang = apply_filters('wpml_default_language', NULL ); 
    		$t_id  = apply_filters( 'wpml_object_id', $t_id, $cate->taxonomy, TRUE, $default_lang );
    	}
    	$product_terms 	= get_option( "taxonomy_$t_id" );
    	$bg 						= (!empty($product_terms['product_category_image'])) ? $product_terms['product_category_image'] : $bg;
            

すべての既知の問題 →