php - Rename Related Products title in Woocommerce 3 -


i used have following function working change related products text in woocommerce.

function my_text_strings( $translated_text, $text, $domain ) {     switch ( $translated_text ) {         case 'related products' :             $translated_text = __( 'related books', 'woocommerce' );             break;     }     return $translated_text; } add_filter( 'gettext', 'my_text_strings', 20, 3 ); 

it worked perfectly, of woocommerce version 3.0 or so, function no longer works.

how should fix in order make working in version 3.0 , up?

try this, it's working me

add_filter(  'gettext',  'wps_translate_words_array'  ); add_filter(  'ngettext',  'wps_translate_words_array'  ); function wps_translate_words_array( $translated ) {      $words = array(                 // 'word translate' = > 'translation'                'related products' => 'check out these related products',        );      $translated = str_ireplace(  array_keys($words),  $words,  $translated );      return $translated; } 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -