WPML
状态
等待作者
相关插件/主题
Motors
主题标签
Compatibility

问题概述

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

临时解决方法

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


  • 打开 app/public/wp-content/plugins/motors-elementor-widgets/templates/widgets/single-listing/listing-data.php 文件

  • 找到第 91 行。

  • 替换:
    <td class="t-label"> <?php echo esc_html( $single_name ); ?></td>

  • 替换为:
    <?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 文本域下)。

所有已知问题 →