How to rename hardcoded WordPress theme files EASILY!

How to rename hardcoded WordPress theme files EASILY!

In my many years of designing websites, there’s always been one niggling issue that crops up – hardcoded text. Despite all the theme options in the WordPress backend, I inevitably must trawl through theme and plugin files to make the changes I want. Well, last week, I found the solution I never knew existed.

Loco Translate has over a million downloads in the WordPress plugin directory, yet it was the first time I’d heard of the tool. Before this solution, I’d manually go through file by file to find any reference to the hardcoded text and often would come to a dead end.

Here’s my overview of how to get up and running with Loco Translate.

1. First, install and activate the plugin.

2. If you are editing theme-based files, go to Loco Translate > Themes. Select the child theme you want to edit (ensure it is a child theme so translations aren’t lost after theme updates) and click Save Config. Make a note of the template file location, as this is where the edits are going to be translated.

3. Next, go to Overview in the top menu and find the language of your site. Ensure that this matches the language set in WordPress Settings > General > Language.

4. Click on the language in Loco Translate > Themes. In here, you will see all the hardcoded words found in your theme. Search and click on the word you want to edit and in the lower box, add the ‘translation’ you want to replace it with.

Click save and sync, and refresh the cache of your website if you have a plugin managing that. Go to your website’s frontend and you should see the changes now live.

Should you be having issues with this, ensure that you are updating the language that matches the language of your WordPress settings. Also, be sure to update the correct theme active on the site. There’s also the likelihood that the text is being updated correctly, but this isn’t that particular reference to it. Perhaps it’s a plugin that’s managing the text displayed on the frontend, and you’re simply updating it elsewhere on the site. If so, follow this guidance to update plugin-based hardcoded text.

5. Go to Loco Translate > Plugins. Select your theme again and go into the Advanced tab. Click save config and also note the POT file being set in the template file field.

Add a new language and make sure you select the exact language as the theme language.

6. Translate. Search for the words you wish to rename and save.

There we have it – a whole lot of time saved!

Get in touch

    Please confirm we can contact you


    Book a consultation with Engage Web