Chèn đoạn code sau vào file functions.php hoặc vào bất cứ 1 file nào khác vào include nó vào trong file functions.php.
Chèn đoạn code sau:
/**
* Code goes in theme functions.php
*
* My quick custom translations or text changes.
*/
add_filter( 'gettext', function ( $strings ) {
/**
* Holding translations/changes.
* 'to translate' => 'the translation or rewording'
*/
$text = array(
'Related products' => 'Customers Also Viewed',
'Something else' => 'Translate/Change',
);
$strings = str_ireplace( array_keys( $text ), $text, $strings );
return $strings;
}, 20 );
Thay các string cần dịch ở trong biến $text như mẫu. Vậy là ok.