This post is outdated – please read my advice for multilingual WordPress here:
I saw lots of interest for this subject – Hey , Matt, isn’t it time for WordPress to get multilingual?
I wrote this simple plugin just because I hated most other solutions, that proved very cumbersome and not very clean – but lately I’m experimenting with good success the new version of the qTranslate plugin wich incorporates much of the desired functionality, and some more bells and whistles, while keeping installation simple:
So this plugin may be a better option for you. I’m going to focus on making qTranslate more SEO!
This is a plugin to turn WordPress into a simple MultiLanguage CMS.
There are other plugins to do so but this one is very light, easy, basic, easily hackable and SEO-friendly.
It has some limits, but it can be perfect in order to use WordPress as a multilanguage basic CMS. Perfect for a multilanguage company website or anything else not too complicated.
The plugin only handles pages. Posts are still there, but the same old way:only in the main language.
The idea behind this simple plugin is that basically, the navigational structure of a multilanguage website looks anyway like a tree, and so it can be perfectly matched via the WordPress standard Page Parent mechanism.
The only problem would be that your theme would obviously list pages in your navigational menus without discerning the language. So we need to introduce a new function to do it properly. That’s what the plugin is mainly for. Don’t worry, it’s very easy to setup once you understand the basic idea!
First, some good news: if something goes wrong and you don’t like this plugin, remember that it does not alter any table of your precious wordpress install. We’re in beta, after all. But I have many websites happily running this plugin.
To make the plugin work, you need to hack your theme just a bit in order to use the new function to list pages, wich will show only pages in the current language, and to insert the classic language switch links/flags. Backup your theme first, and then start hacking!
- English, French, Deutsch, Italian, Dutch and Spanish supported
- Handle easily the website’s architecture via classic Parent Page WordPress feature, very intuitive and decently easy to maintain for simple websites!
- The plugin assumes you want English as the default language (this can be easily changed)
- We assume your website has English pages before starting the tutorial
- The plugin will NOT change the URLS of your English pages. This is good news for the search engines!
- Permalinks MUST be enabled (your page’s URL should look like www.domain.com/page-name, NOT www.domain,com/?p=15. (If permalinks are not enabled, the mlg_links function will not work, and you’ll have to do some easy homework manually placing in your theme links to the the foreign homepages)
Install this preliminary great plugin: is_child. Activate the plugin.This is needed in order to make everything work. MultiLanguage CMS will break your theme if is_child is not installed and active!
Now, download and install the Multilanguage CMS plugin:
After downloading, activate the plugin. No configuration necessary here. Now take a deep breath and go on!
Hack your WordPress Theme to call the new template tags!
That is very easy but needs a bit patience for the newbies. Some minutes, shouldn’t be more! You just need to know how to use an FTP client and a text editor.
Typically you’ll have to edit your header.php (or more files) in the active Theme folder.
In this file, substitute the standard wp_list_pages function with the wp_mlg_list_pages function, introduced by the plugin.
<ul><?php wp_mlg_list_pages(‘&title_li=’); ?></ul>
And then decide where do you want to put the language switching standard navigation links. Somewhere in the header, right? Or maybe in the sidebar ? (SamsarinPhpWidget would be handy)
Just call the mlg_links function – copy and paste this code wherever you want the language switching links to appear:
This function simply echoes some links, showing only languages that have at least a page. Continue reading!
How to add a new language – handling the languages in the WordPress admin panel
We assume your WordPress website has already pages for the main language (typically English).
So let’s see how to add a language! Be careful to follow the instructions precisely and it will work in a snap. Pay attention to lowercase / uppercase – we have some case sensitive stuff here.
- Create a new page (for the new language homepage), add some content
- In this page, create a custom field called mlg_home and set value to the abbreviation of it’s language (it for Italian, de for deutsch, nl for Dutch, es for Spanish, fr for French…) (this explains to the plugin that the current page will be the homepage of the specified language) VIEW SCREENSHOT
- Publish the page
- For SEO: Re-edit the page and set the page slug to the abbreviation of the new language (it for Italian, de for deutsch, nl for Dutch, es for Spanish, fr for French…) so the URL will be pretty VIEW SCREENSHOT
- To add more pages in that language: Create page, add content, and select the right language’s home page in the Page Parent select. So you are putting new pages in their right place in the ideal tree architecture of the web site.
You’re done! If you did everything well, you’ll see that a new link is born for the new language (printed by the mlg_links function), and clicking this link you should see only pages of that language listed by the wp_mlg_list_pages function you’ve added before.
How do I disable the plugin? What, the theme breaks?
If you want to disable the plugin, make sure you revert the theme hacks BEFORE – otherwise your theme will break. This is why I advide you to backup your theme before installing the plugin. Anyway, it’s not a great problem: You’ll still be able to enter the wp-admin if you’re stuck in such a situation – just reactivate the plugin and everything will come back to life. This happens because you are calling a function wich is not defined. You could easily avoid that using if function_exists – but I wanted to keep the code as elementary in the example.