Replace the placeholding text

Hi !

I would like to replace the placeholding text of the search bar.
I tried what is indicated here but it did not worked.

Any idea ?

Thanks !

Hi there,

A quick way to do this would be using Javascript to alter the placeholder text. Please try adding this in the Global JS:

jQuery('.form-search .search-query').attr('placeholder','Your text here.');

Hope this helps.

Thanks but it does not seems to work. Any other solution ? :slight_smile:

Hi there,

Please try this in the functions.php file of the child theme.

// Translate Strings
add_filter( 'gettext', 'translate_x_strings', 20, 3 );

function translate_x_strings( $translated_text, $text, $domain ) {

	switch ( $translated_text ) {

		case 'Search' :

			$translated_text = __( 'Your search text here.', '__x__' );
			break;

	}

    return $translated_text;
}

You will have to login through FTP and go to wp-content/themes/pro-child then you should be able to see the functions.php file from there.

Hope this helps.

Perfect Thanks ! :slight_smile:

You are most welcome. :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.