このユーザーにはお気に入りのトピックがありません。
お気に入りのフォーラムトピック
作成したフォーラムトピック
| ステータス |
トピック
|
サポーター | 声 | 投稿 | 新着度 |
|---|---|---|---|---|---|
|
wpml function to display translated strings
開始者:John
カテゴリ:English Support
Problem: bloginfo('name'). However, using the Site name for English and the tagline for Welsh causes issues when the Site name is translated in String Translation. add_action( 'init', function() {
do_action( 'wpml_register_single_string', 'site_settings', 'blogname_en', 'Your Site Name in English' );
do_action( 'wpml_register_single_string', 'site_settings', 'blogname_cy', 'Your Site Name in Welsh' );
});After registering the strings, you can retrieve them on the frontend with the following code: $en = apply_filters( 'wpml_translate_single_string', 'Your Site Name in English', 'site_settings', 'blogname_en' ); $cy = apply_filters( 'wpml_translate_single_string', 'Your Site Name in Welsh', 'site_settings', 'blogname_cy' ); echo esc_html( $en ) . ' ' . esc_html( $cy ); This approach ensures that both the English and Welsh names appear on the page regardless of the selected language. Please note that this solution might be irrelevant if it’s outdated or not applicable to your case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If this does not resolve your issue, please open a new support ticket. |
|
1 | 15 | 4ヶ月、 2週前 |