Support » Plugin: WPGlobus - Multilingual Everything! » How to translate wp_postmeta
How to translate wp_postmeta
-
Hi
my theme writes some fields in wp_postmeta
How can I add a translation for them?
for example for field meta_key=ut_section_slogan
http://fs42.www.ex.ua/show/936790481186/196146634/196146634.png?1600
-
частично решает проблему
https://wordpress.org/support/topic/manually-use-language-tags
добавил в код
$ut_section_slogan = apply_filters( ‘the_title’, get_post_meta( $postID , ‘ut_section_slogan’ , true ));
и в админке в поле ut_section_slogan
{:ru}Russian text{:}{:en}English text{:}так и не понял почему
https://wordpress.org/plugins/wpglobus-translate-options/ не решает эту проблему ?No, Translate Options will not filter meta. But your code should work.
Может код не в том месте ? Выглядит нормально.
да
$ut_section_slogan = apply_filters( ‘the_title’, get_post_meta( $postID , ‘ut_section_slogan’ , true ));
сработало, но было бы здорово если бы в настройках плагина можно было ввести
ut_section_slogan и другие поля из таблицы wp_postmeta для которых нужен перевод
А так прийдется при каждом обновлении темы добавлять старые изменения@webspilka
чтобы не добавлять изменения при обновлении вы можете создать дочернюю тему
https://codex.wordpress.org/Child_ThemesTo resume:
- WPGlobus does not translate the
postmeta
strings at the moment - We’ll consider adding this functionality in a next release of WPGlobus or WPGlobus Plus
- A code like
apply_filters( 'the_title', get_post_meta( $postID , {post_meta_key} , true ));
can be used for workaround - If the patch goes to the theme, it’s recommended to use child theme
Thank you, @webspilka, for this question.
- WPGlobus does not translate the
- The topic ‘How to translate wp_postmeta’ is closed to new replies.