How to change a certain text or term of WordPress into a custom into the whole site?

This is a trick. You can use the WP translation functionalities.

There are 2 possibilities:

  1. You are using the default English version of WP
  2. You are using a localized version.

Case 1:

  1. Under content folder (usually /wp_content) create a folder named ‘languages’

Case 2:

  1. Under content folder (usually /wp_content) there is a folder named ‘languages’ in which there are some files
  2. Two files (at least) are related to your language, they are named like xx_XX.po and xx_XX.mo where xx_XX is the code for the language. Sometimes there are another 2 files: admin-xx_XX.po and admin-xx_XX.mo
  3. If there are files admin-xx_XX.po and admin-xx_XX.mo make a copy these 2 files, otherwise make a copy of xx_XX.mo and xx_XX.po, and put it in a different folder.

Now you can follow the following instructions, not mind if yours is case 1 or 2:

  1. Download, Install and Activate the plugin Codestyling Localization
  2. In WP dashboard, under Tools menu you will find the menu item Localization, click it
  3. Screen is parted in two, an the left you can see all your themes, your plugins and, first of all WordPress itself. On the right you can see al the languages available for WordPress, themes and plugin. In the WordPress row, if you are using a localized version you will see your language otherwise you will see nothing. Don’t mind, click on the button Add Language and in the window that appear, choose a language that, for you, is as strange as possible, something like ‘isiZulu’ with language code ‘zu_ZU’ (it’s the last one).
  4. Now you can see language you have chosen in the list: there is a flag, language names and some buttons.
  5. If you are running a standard English version of WP skip this step. Otherwise, open the folder /wp_content/languages and you will see 1 file, e.g. zu_ZU.po. Take the 2 files you have copied in the instructions of Case 2, rename the file .po in zu_ZU.po and the file .mo in zu_ZU.mo then copy these renamed files in /wp_content/languages (so replace zu_ZU.po).
  6. Back to WP Dashboard -> Tools -> Localization and refresh the page. Click on the ‘Rescan’ button that is next to the new language flag. The plugin start its work and when finished click on the ‘Edit’ Button.
  7. Now you will see a table with 2 columns, on the left there are the English strings of WordPress (every string used by WordPress is here, there are about 1600 strings!) on the right there are the translations (all blank if you are running a standard English version).
  8. Start translating. Search for the words and sentences you want to change, e.g. “Posts” and translate them in your *personal language” e.g. “Posts” became “Products”, and so on.
  9. When finished, click on the button “Generate mo-file” in the header of the page.
  10. Now you have to tell WordPress to use your language. On your wp-config.php file write: define('WPLANG', 'zu_ZU'). Note: if you are using a localized version, this definition is already there: don’t add again, change the language code instead.
  11. Refresh the page in WP dashboard and see the magic 🙂

Leave a Comment