ผู้ใช้นี้ไม่มีหัวข้อที่ชื่นชอบ.
หัวข้อฟอรัมที่ชื่นชอบ
หัวข้อฟอรัมที่สร้าง
| สถานะ |
หัวข้อ
|
ผู้สนับสนุน | เสียง | โพสต์ | ความใหม่ |
|---|---|---|---|---|---|
|
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 months, 1 week มาแล้ว |