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 1 reply, has 1 voice.

Last updated by Malin 12 months ago.

Assigned support staff: Marcos Vinicios Barreto.

Author Posts
October 24, 2018 at 1:15 pm #2846404

Malin

I have created a new section in customizer and now I am trying to translate some text fields.
My code in customizer.php

$wp_customize->add_setting( 'pax_header_title', array(
		'capability' => 'edit_theme_options',
		'default' => 'Rubrik',
		//'sanitize_callback' => 'sanitize_text_field',
		'awd_callback' => function() {
				return get_theme_mod( 'pax_header_title' ); //to allow html tags in text field
			}
	) );

And the output is looking like this right now (back to basic, I deleted my tests):

<?php $header_title = get_theme_mod('pax_header_title' );
				if( !empty($header_title) ) { ?>
				<h1>
					<?php echo $header_title;					
					?>
					
				</h1>
				<?php } ?>

I have followed a lot of tip I have found but I don't seem to succeed to make this fields to end up in the string translation.
How can I change the code to make this possible?

Regards Malin

October 24, 2018 at 3:34 pm #2847105

Malin

I found and followed this: https://wpml.org/forums/topic/translating-input-fields-in-customizer/ and finally the problem is solved!