Skip Navigation

Resolved by author

Resolved in: Blocksy Companion 2.0.33

Topic Tags: Compatibility

Overview of the issue

In the Blocksy theme, when using the Products Tab feature with WPML, tabs translated into a secondary language may incorrectly display in the original language on the front end.

Workaround

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

  • Open the …/wp-content/plugins/blocksy-companion-pro/framework/premium/extensions/woocommerce-extra/features/custom-tabs/feature.php file
  • Look for line 139.
  • Replace:
    $all_products_tabs = get_posts([
    	'numberposts' => -1,
    	'post_type' => $this->post_type,
    ]);
    
  • With:
    $all_products_tabs = get_posts([
    	'numberposts' => -1,
    	'post_type' => $this->post_type,
    	// WPML Workaround for compsupp-7255 - PART 1
    	'suppress_filters' => false
    ]);
    
  • Then, open the …/wp-content/plugins/blocksy-companion-pro/framework/features/conditions/rules-resolver.php file
  • Look for line 364.
  • Replace:
    if (
    	isset($rule['payload'])
    	&&
    	isset($rule['payload']['post_id'])
    	&&
    	$post_id
    	&&
    	intval($post_id) === intval($rule['payload']['post_id'])
    ) {
    	return true;
    }
    
  • With:
    // WPML Workaround for compsupp-7255 - Part 2
    if ( class_exists('Sitepress') ) {
    	$rule['payload']['post_id'] = apply_filters( 'wpml_object_id', $rule['payload']['post_id'], get_post_type($rule['payload']['post_id']) , TRUE  );
    }
    
    if (
    	isset($rule['payload'])
    	&&
    	isset($rule['payload']['post_id'])
    	&&
    	$post_id
    	&&
    	intval($post_id) === intval($rule['payload']['post_id'])
    ) {
    	return true;
    }
    

Leave a Reply

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.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>