How to make a WordPress post in a different language

Per Post Language

In this tutorial, we will show you how to write a wordpress post in a different language (which is not the main language of your wordpress website).

In order to avoid any confusion, let's clarify a little : we won't talk about how to translate a post into several languages (there are lots of tutorials for that, most of which use the Polylang plugin).

We simply want to set a language per post. For example, on this website (modeseeker.com), some posts are in English like this one, but most are in French.

Why is it interesting ?

Specifying a language per post has several advantages :

  1. Search engines will understand that your post is written in the specified language,
  2. The post data (such as date, number of comments, etc.) and navigation buttons will be displayed in the correct language,
  3. You will then be able to use the post language to trigger different behaviours on your website depending on the language. (for example banners, ads, etc.).
Example of a post with its data displayed in French

How to do it

It's very simple : just install the "Per Post Language" plugin by Fahad Alduraibi. It isn't in the official WordPress plugin directory anymore, but you can find it here :

https://modeseeker.com/wp-content/uploads/2021/01/per-post-language.1.3.zip

You will have to install it manually : go to Plugins, then Add Plugins, and Upload Plugin.

Upload Per Post Language plugin

Upload the zip file and click install. Then go to Per Post Language settings, and add the languages you need to the "selected languages" list.

Per Post Language settings

Then, edit the post for which you want to set a different language. On the right panel, you should see a list of the available languages. Select the one you want, and you're done !

If you want to check the language specified to search engines, check the source code of your page. You should see it on the second line of the source code :

Source code of article in French

Finally, if you need to trigger different behaviours on your webiste based on a post language, you can use the following syntax in your wordpress structure files :

if(strstr(get_bloginfo("language"),"fr-FR")==true)
{
    ?>
    <div>Your text here</div>
    <?php
}

In this example, we check whether the post is in French to display a div containing text.

That's it ! Thanks to this great WordPress plugin, you can now write posts in multiple languages, knowing that the user experience of your visitors will be perfect and that you will be correctly indexed by search engines.

If you have any question, don't hesitate to leave us a reply below, we reply within 24h.

Leave a Reply

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

Modeseeker : comparateur de promotions

Nous recherchons les meilleures promotions disponibles sur internet, pour que vous puissiez trouver facilement des vêtements de marque pour homme au meilleur prix : polos Ralph Lauren, pulls Tommy Hilfiger, jeans Levi's... Notre algorithme analyse chaque jour des dizaines de sites d'e-commerce, que nous avons sélectionnés pour leur sérieux et leur fiabilité. Nous sommes indépendants de toute marque ou tout site de vêtements.