How to make a custom wordpress theme multilingual

21st Dec 2017
How to make a custom wordpress theme multilingual

When looking to make a Wordpress site multilingual it can be hard to know where to begin. I encountered this scenario when tasked with making available in Spanish and decided to use Polylang to translate the main bulk of the content, as it allows translating of custom fields through either Advanced Custom Fields, or Custom Field Suite in my case (which Polylang doesn’t explicitly support but seems to function correctly regardless).
However, then comes the issue of hardcoded strings, such as copyright text or input field placeholders, which cannot be translated by Polylang. For these I opted to use a plugin called Loco Translate which lets users translate hardcoded strings from within Wordpress admin. To set this up you will need to edit all your hardcoded strings so that they can be identified as translatable strings by the plugin. For example, a placeholder for an email input would go from:






placeholder="<?php _e('email', 'YOUR THEME NAME') ?>"


When you have updated all your hardcoded strings you will need to create a ‘languages’ folder in the root of your theme folder and download a blank .pot file from and place this file within the languages folder. You will then need to open this file using a PO editor (poedit was my choice) and change the source to your theme folder and update from sources. This should then list all your translated strings and you can now save the file and open with Loco Translate. You should then be able to enter translations for the strings which will then update when you change language with the Polylang language switcher.

Leave a Comment

Submitting this form will create you an account on this site for submitting comments, raising disputes and other features as we add them. If you've already got an account you will receive an email asking you to confirm this comment is really by you!

Know a great web designer, developer or marketer?

Tell them to apply to join The Web Guild - it’s free for anyone who gets a company profile approved before the end of March! Read our How it Works page or sign up here!

<< Back to news