The vast majority of the text on your site comes from your own content. However there’s a small amount that comes with the theme and that in very few instances you’d wish to change to something else.
The first though would be to dive right into the theme files and search for that text to edit it right there, right? That usually works, but just not always (not all theme files are simply customizable using a child theme, not all functions can be unhooked, and so on).
Luckily, WordPress provides for a way to do this more easily. With the aid of translations, we can simply tell WordPress to display a particular string in the place of a built-in one (as long as the theme supports translations and all its strings are translateable – all our themes are). “But translating the theme to a different language is not what I need”, some will say. Don’t worry, you don’t have to: you can “translate” the theme from English to English, too.
As an example I’ll be using Nirvana and we’ll say we want to edit the “Bookmark” label (displayed at the end of single posts), changing it to “Add this to favorites”.
- We’ll start by installing a translation editor plugin – my plugin of choice is Loco Translate which we can install by navigating to Plugins > Add New and typing its name in the filter box at the top.
Click Install now and then Activate.
2. Navigate to Loco Translate > Themes and select the desired theme from the list. Click the New language button below the theme name
Optional: At the next step you may get a Template missing warning message (in case the author did not include a POT file with the theme). We can click Create template to tell Loco translate to generate the translations from source (may take slightly longer) and then we can resume the language creation step.
3. Next we chose the language we want to edit – in the case of this tutorial this will be the English (United States) because we need to edit strings in the theme that while not actually switching to a different language.
However this is also possible for any other language.
For the file location do NOT chose the first option – this would place the new translation in the theme folder which will be lost at the next theme update. We’ll be using System. Click on Start translating.
4. We finally arrive at the translation editing screen. Here is where we browse through or search all the theme strings and can insert translations for them.
Search for ‘bookmark’ (the string we initially wanted to change) – the plugin will dynamically filter and show results that match.
Select the string by clicking on it and enter the desired “translation” (or in our case replacement string) in the bottom box:
Repeat this for all strings that we want to edit, then finally click Save.
That’s it! We can now return to the frontend to find our new text in place:
This procedure will work with all our themes to edit any of their texts without actually editing files.