Words Preparation: The Building Blocks of Multilingual Magic
Before diving into the world of translations, let’s gather our words like a squirrel hoarding acorns for winter. You’ll want to prepare a list of essential phrases that will make your website feel like a cozy multilingual café.
Think “Welcome,” “Author,” and “Contact Us.”
These are the bread and butter of your site’s communication. Once you have your list, you’re ready to sprinkle some translation fairy dust!
Installing Polylang Plugin: The First Step to Bilingual Brilliance
Now that you’ve got your words prepped, it’s time to install the Polylang plugin. Head over to your WordPress dashboard, navigate to Plugins, and click on “Add New.”
Search for “Polylang,” and when you find it, hit that shiny “Install Now” button. Once it’s installed, don’t forget to activate it! Voilà! You’re one step closer to becoming a multilingual maestro.
Theme ‘functions.php’ Implementation Code: A Dash of Code for a Splash of Translation
Now, let’s get our hands a little dirty with some code. Open your theme’s
functions.php file and add the following snippet. This little gem will help you register your custom words for translation:1 | pll_register_string( $name, $string, $group, $multiline ); |
Copy into Theme’s functions.php
1 2 3 4 5 6 7 8 9 10 | ... function my_custom_translations() { //pll_register_string( $name, $string, $group, $multiline ); pll_register_string(‘welcome_msg’, ‘Welcome Home’, ‘Custom Word’, false); pll_register_string(‘author_msg’, ‘Author Here…’, ‘Custom Word’, false); pll_register_string(‘contact_msg’, ‘Contact Us’, ‘Custom Word’, true); } add_action(‘init’, ‘my_custom_translations’); ... |
This code registers your words with Polylang, making them ready for translation. It’s like giving your words a VIP pass to the translation party!
Check in Polylang “Languages – Translations” Menu: The Proof is in the Pudding
After you’ve added your code, it’s time to check if your words have successfully made it to the Polylang translation hall of fame. Navigate to the “Languages” menu in your WordPress dashboard and click on “Translations.”
Preferably, to avoid confusion, select the “Custom Word” Group.

If you see your words listed there, congratulations! You’ve successfully registered your translations. If not, don’t panic—double-check your code and try again.
Usage in ‘single.php’ or ‘content.php’ : Bringing Your Translations to Life
Now that your words are registered, it’s time to use them in your templates. Open your
`single.php` or
`content.php` file and replace the static text with the Polylang function. Here’s how you can do it:
1 2 3 | <?php echo pll__(‘Welcome Home’); ?> <?php echo pll__(‘Author Here…’); ?> <?php echo pll__(‘Contact Us’); ?> |
or
1 2 3 | <?php pll_e(‘Welcome Home’); ?> <?php pll_e(‘Author Here…’); ?> <?php pll_e(‘Contact Us’); ?> |
Remember! Only retrieve the $string value, then place the code snippet where you want it to go
This code will dynamically pull the translated versions of your words based on the user’s selected language. It’s like having a personal translator on your website!
Your Multilingual Journey Begins
Congratulations! You’ve successfully created translation words using the Polylang WordPress plugin. With your newfound skills, you can now cater to a diverse audience and make your website a welcoming space for everyone. So go ahead, embrace the multilingual magic, and let your words travel the world!

Leave a Reply