Sauter la navigation

Open

Topic Tags: Compatibility

Overview of the issue

When using the Salient theme with WPML and WooCommerce, the category header image does not appear on translated product category pages. This is because the image assigned to the original category is not automatically copied or displayed for translations.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open the …wp-content/themes/salient/nectar/helpers/page-header.php file.
  • Look for line 151.
  • Replace:
    // 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;
            
  • With:
    // 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;
            

Laisser une réponse

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

Vous pouvez utiliser ces balises :
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>