Skip Navigation

Resolved by author

Topic Tags: Compatibility

Overview of the issue

When you add Testimonials in the Customize section with Hestia Pro theme, they all appear combined into a single large string in WPML > String Translation page, making them difficult to translate individually.

Workaround

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

  • Add the following snippet to the theme’s functions.php file:
    // WPML Workaround for compsupp-6971
    function wpml_compsupp6971_translate_strings_from_hestia($original_value, $domain) {
    	
    	if( class_exists('Sitepress') ){
    		$string = $original_value;
    		$textdomain = 'hestia-pro';
    		$string_name = $domain.': '.substr($string, 0, 20);
    	
    		$wpml_default_lang = apply_filters('wpml_default_language', NULL );
    		$wpml_current_lang = apply_filters( 'wpml_current_language', NULL );
    	
    		if ($wpml_default_lang == $wpml_current_lang ) {
    			do_action( 'wpml_register_single_string', $textdomain, $string_name, $string );
    		}	
    
    		// Apply the translation to the string
    		$wpml_translation = apply_filters('wpml_translate_single_string', $string , $textdomain, $string_name);
    	
    		return $wpml_translation;
    	}
    	
    	return $original_value;
    }
    
    add_filter( 'hestia_translate_single_string', 'wpml_compsupp6971_translate_strings_from_hestia', 11, 2 );
    
  • Visit the page in the front-end to register the strings.
  • Go to WPML > String Translation page and translate the strings

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>