问题概述
当您将 PublishPress Authors 与 WPML 结合使用时,您可能会遇到以下问题:您在字符串翻译中翻译了作者简介,但翻译后的文章仍以默认语言显示该简介。
临时解决方法
将此代码添加到您主题的 functions.php 文件或代码片段插件中,然后在WPML字符串翻译(域 PublishPress Authors)中翻译该简介:
PHP
add_filter( 'publishpress_authors_author_attribute', function ( $value, $term_id, $attribute ) {
if ( 'description' !== $attribute || ! is_string( $value ) || '' === $value ) {
return $value;
}
return apply_filters( 'wpml_translate_single_string', $value, 'PublishPress Authors', '#' . (int) $term_id . ' Biographical Info' );
}, 10, 3 );