Your Guide to Creating (Custom) Translation Words in WordPress

Unlocking the Power of Polylang Plugin | Part 1

A Girl doing coding

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:

Copy into Theme’s functions.php

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.
Polylang Translator Menu
Polylang Translator Menu
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:

or

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!
cards
Powered by paypal

Response

Leave a Reply

Your email address will not be published. Required fields are marked *