This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 2 replies, has 2 voices.
Last updated by marcoR-2 1 year, 7 months ago.
Assisted by: Nicolas V..
Author | Posts |
---|---|
September 21, 2023 at 5:14 am #14434483 | |
marcoR-2 |
I've registered few strings for show translated content in the backend. Here part of the code: All are working minus "Main Location" Any help to make it work, please? |
September 21, 2023 at 4:36 pm #14441109 | |
Nicolas V. Supporter
Languages: English (English ) French (Français ) Timezone: America/Lima (GMT-05:00) |
Hello, Welcome to the WPML support forum. I think that you can't use __() function for the default value 'std' because it's not a label. - You should use 'std' => 'Main location',. Here is an example generated with hidden link: <?php add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' ); function your_prefix_register_meta_boxes( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => esc_html__( 'Untitled Field Group', 'online-generator' ), 'id' => 'untitled', 'context' => 'normal', 'fields' => [ [ 'type' => 'text', 'name' => esc_html__( 'Location Name', 'online-generator' ), 'id' => $prefix . 'location_name', 'desc' => esc_html__( 'Description', 'online-generator' ), 'std' => 'Default value', 'placeholder' => esc_html__( 'Main location', 'online-generator' ), ], ], ]; return $meta_boxes; } PS: Note the use of esc_html__() which will escape the text for safe use instead of __(). |
September 22, 2023 at 6:30 am #14443493 | |
marcoR-2 |
Hi. At the end, __() is working propertlly with 'std' Thank You |