WPML

问题概述

使用 Motors 主题 时,您可能会发现某些列表类别标签在前端未显示为已翻译,尽管已在 WPML 字符串翻译界面中进行了翻译。

临时解决方法

这个问题已修复。 更新到最新版本即可在您的站点上解决此问题,因此,只有当您暂时无法更新时,才需要此临时解决方法。

在继续操作之前,请确保对您的网站进行了完整的网站备份。

  • 打开 app/public/wp-content/plugins/motors-elementor-widgets/templates/widgets/single-listing/listing-data.php 文件
  • 找到第 91 行。
  • 替换:
    PHP
    <td class="t-label"> <?php echo esc_html( $single_name ); ?></td>
  • 替换为:
    PHP
    <?php
    	// WPML Workaround for compsupp-7432
    	if ( class_exists('Sitepress') ) {
    		$textdomain = 'motors';
    		$string_name = 'Motors - WPML String: '.substr($single_name, 0, 20);
    
    		if ( apply_filters('wpml_default_language', NULL ) == apply_filters( 'wpml_current_language', NULL )) {
    			do_action( 'wpml_register_single_string', $textdomain, $string_name, $single_name );
    		}	
    		// Apply the translation to the string
    		$single_name = apply_filters('wpml_translate_single_string', $single_name , $textdomain, $string_name);
    	}
    ?>
    
    <td class="t-label"> <?php echo esc_html( $single_name ); ?></td>
  • 以原始语言访问出现问题的页面,这将注册该字符串。
  • 前往 WPML字符串翻译页面,并翻译新字符串(在 motors 文本域下)。

所有已知问题

仍然遇到此问题?

如果更新无法解决问题,请提出支持问题,我们将与您一起排查。