Woo-search-widget try to change text of search results

Hi there,
I try to change the text “Search Results” and "Below you’ll see everything we could locate for your search of “
But i use the woocommerce search widget.

I tried to add this code to my child-theme but it didnt work.
Can you please advise how to do?
Many thx!!

.search-results .entry-featured {
position: relative;
margin-top: 20px;
margin-right: 10px;
border: 2px solid #e5e5e5;
padding: 6px;
background-color: #fff;
max-width: 250px;
float: left;
}

Hey,

Thank you for writing in!

Ensure that you read this article: https://theme.co/apex/forum/t/setup-how-to-setup-child-themes/57 and if you can`t solve this issue, provide to us your URL and WP credentials in a secure note. This way we can take a look closer and investigate this problem easily.

Hi and thx for your response.
I have set up my child-theme already. that’s not the problem.

Please have a closer look I will add my credentials to secure note.

Many thx in advance :slight_smile:
Maik

Hello There,

Thanks for providing the information. To change the text so something else, you will have to translate your X theme to German. You can start translating all the strings from English to German by checking out our knowledge base from here: https://theme.co/apex/forum/t/setup-translation/61/1

If you want want to translate the two strings, please add the following code in your child theme’s functions.php file

// Translate texts
// =============================================================================
function translate_texts($translated) { 
  $translated = str_ireplace('Search Results', 'insert your translation here', $translated);
  $translated = str_ireplace('Below you'll see everything we could locate for your search of', 'insert your translation here', $translated);
  
  return $translated; 
}
add_filter('gettext', 'translate_texts' );
// =============================================================================

Hope this helps. Please let us know how it goes.

Hello RueNel,

Thx for your response.
Unfortunately your code gave me this error:
Parse error: syntax error, unexpected ‘ll’ (T_STRING) in /home/www/xxx.ch/wp-content/themes/x-child/functions.php on line 166

line166 is:
$translated = str_ireplace(‘Below you’ll see everything we could locate for your search of’, ‘insert your translation here’, $translated);

Thank you for looking at this 1 more time
REgards

Hi there,

Please try to update the code to:

// Translate texts
// =============================================================================
function translate_texts($translated) { 
  $translated = str_ireplace('Search Results', 'insert your translation here', $translated);
  $translated = str_ireplace('Below you\'ll see everything we could locate for your search of', 'insert your translation here', $translated);
  
  return $translated; 
}
add_filter('gettext', 'translate_texts' );
// =============================================================================