WordPress MultiLingual Sites – How to Build using WPML

If you purchase through a link on our site, we may earn a commission. Learn more.

Is WordPress capable of handling the intricacies of Multilingual websites? The short answer is a resounding YES! Let's explore how to build a multilingual theme and website together in this guide.
Table of Contents

Is WordPress capable of handling the intricacies of Multilingual websites? The short answer is a resounding YES! Let’s explore how to build a multilingual theme and website together in this guide.

Step 1: Choosing a MultiLanguage Plugin

First of all, we need to understand that WordPress in itself does not come with any multilanguage features. You will need to install a plugin to really get going. There are a number of alternatives, which we have already discussed in a previous post about WordPress multilanguage plugins. For this tutorial we will be using WPML, which is probably the most supported and fully featured of all WP multilanguage plugins.

WPML has recently made the transition from being a free plugin to being a paid plugin. Although we would always like things to be free, I believe the improvements brought about by the change are worth the cost. The code is now much cleaner and more secure. Moreover they have the divided the plugin into several smaller plugins which can be enabled on demand, thus reducing the load on your server. The switch to a commercial model will also enable the WPML team to focus more on support and improving the plugin. According to their website, the next releases will improve interoperability with popular plugins such as W3TC, AIOSEOP, Shopp, WP E-Commerce and NextGen Gallery. We definitely look forward to such improvements.

The first step to Multilanguage nirvana is thus purchasing WPML and installing it on your site. For a start, I recommend you install the following:

  • WPML Multilingual CMS (the core plugin)
  • WPML String Translation (add-on)
  • WPML Translation Management (add-on)

Step 2: Translating the Theme

If you have downloaded a free theme or purchased one, chances are that it is already set up to be multilanguage compatible. If however you are creating the theme yourself you need to make sure to implement some minor changes in order to transform it into a multilingual theme. The nice thing about WPML is that you don’t need to create any .mo or .po files yourself, all this is handled by the WPML String Translation add-on.

WPML provide 2 excellent guides on how to create a multilingual theme, so we won’t be repeating the information here. It is worth mentioning that themes should use GetText for localisation. Take a look at the WPML guides:

https://wpml.org/documentation/support/creating-multilingual-wordpress-themes/

https://wpml.org/2009/05/wordpress-theme-localization/

Linking to the Home Page

When linking to the Home page of your site, you need to use the following function to load the correct language according to what the user had selected:

<a href="<?php echo wpml_get_home_url() ?>">

Using Hard Coded Links in the Theme

If you are including any hard coded links in your theme, you need to use this:

wpml_link_to_element($element_id, $element_type='post', $link_text='', $optional_parameters=array(), $anchor='');

More info on this here:

https://wpml.org/documentation/support/creating-multilingual-wordpress-themes/hard-coded-theme-links/

Returning the Right Contents Per Language

When getting posts into a page or post template (for example to display a few featured posts), you need to adjust the IDs to reflect the language that has been selected. You can use the following code for this:

wpml_get_object_id($element_id, $element_type='post', $return_original_if_missing=false, $ulanguage_code=null);

Other Plugins that Can Be Useful

Amir Helzer of WPML has recently penned an article entitle 9 Killer Plugins for a WordPress Multilingual Website, you should definitely check it out for more ideas about plugins you can use when building a multilanguage site in WordPress.

Do you have any experience building multilingual sites with WordPress? Have you used WPML or other plugins for the job? Share your experience in the comments section!

Jean Galea

Jean Galea is an investor, entrepreneur, and blogger. He is the founder of WP Mayor, the plugins WP RSS Aggregator and Spotlight, as well as the Mastermind.fm podcast. His personal blog can be found at jeangalea.com.

Discover more from our archives ↓

Popular articles ↓

15 Responses

  1. Hey Guys!

    I am going to have my site ( ) in other languages. Some of them are RTL such as Arabic and Farsi and some others are LTR.

    As Enfold is a translation ready theme, could you guys let me know the steps (1- 2 – 3 …) I need to take to create my website in other languages. I’ll start with Farsi.

    Thanks,
    Mike

  2. hello i’m using wpml with this theme
    In the theme I’m setting a Page as homepage for the site, of course to set different pages for each language section, but the theme does not allow to specify the hp page for each language… what should code should I add in the theme to change the page according to the language? I always use the translation of the same page.
    If it’s not possibile, do you know of any multilingual theme that looks similar, so that I can change theme? You mentioned you were developing multilingual themes…

    Thanks

  3. Hi Jean,

    Nice review !

    How come if it’s so easy to make a multilingual WordPress site, there is so less examples in the marktet ?

    Didier

    1. Hi Didier, thanks! It may be easy to set up a multilingual site, but the truth is that it takes a lot of hard work to create content in multiple languages, so that might be a reason why many people shy away from it.

  4. Is WordPress and it’s WPML plugin as good or better at handling languages than, say, Drupal or Joomla … or are they all the same? What about non-common languages like Malagasy.

    1. I don’t have much experience doing multilingual Drupal or Joomla, but what I can say is that WordPress + WPML can pretty much handle any language you can throw at it impressively well.

  5. Cheers Jean.

    And in the spirit of sharing here are my wordpress bookmarks

    @johnthunder on twitter

    1. Not that I know of John, you should be able to work normally with permalinks. Check the part about permalinks on this page:

  6. Do you know of any WordPress multilingual-ready themes? I guess it would be easier for noobs like me to have a theme with inbuilt translation functionality rather than having to install a plugin.

    1. Yes we will be releasing a round up of themes which have the translation functionality in-built, however you should know that it is also very easy to use WPML with any well-coded theme out there.

  7. Hey, I’m assuming there’s a way to have strings in the template translated that’s more elegant than using “if( ‘en’ == ICL_LANGUAGE_CODE )”.

    Could you share some knowledge on that?

    1. Yes WPML has functionality that automatically detects translatable text in the theme and offers an interface for translating it.

Share Your Thoughts

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

Claim Your Free Website Tip 👇

Leave your name, email and website URL below to receive one actionable improvement tip tailored for your website within the next 24 hours.

"They identified areas for improvement that we had not previously considered." - Elliot

By providing your information, you'll also be subscribing to our weekly newsletter packed with exclusive content and insights. You can unsubscribe at any time with just one click.