Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 13 replies, has 6 voices.

Last updated by Anonymous 10 years ago.

Author Posts
June 29, 2010 at 2:23 pm #18778


I tried to look this up but only found other people asking about it but no answers. Is it possible to have classes added to body based on language? class="en" etc. This seems like the most basic feature to have but can't find anything about it, weird.
Also, I'm not trying to be rude but after launching the commercial support, have you, the developers, completely abandoned doing non-commercial support on the forums? There's like 3 pages of new topics and I see very little to no interaction from devs.

June 29, 2010 at 2:41 pm #18780


We now employ an expert developer doing the paid support. He's spending time working with folks on their sites, getting things to work smoothly and elegantly.
Besides that, we're also busy adding multilingual support for WordPress 3.0 menus, BuddyPress and other important new features.
WPML has more than 100,000 downloads and at least 15,000 active sites. If we answer all the threads in the forum, we'll have no time at all for development and actual bug fixes.
The paid support allows us to dedicate the resources needed to give timely and accurate support. I understand it's not the right solution for everyone. I'm happy that other folks are spending their time helping each-other here in the forum.

June 30, 2010 at 9:48 am #18781


Ok, thanks for the answer, that's completely justified.
I actually just bought the paid support last night but I think I need to update my WPML (mine is 1.7, I think) but the last time I tried to do this, the whole site got completely messed up, had to revert back to backups (which unfortunately were a day or so old so I lost a bit of work, but nothing too much).
Will I also get help on the original issue I mentioned here in the first post in the paid support? Does it cover helping like that?

June 30, 2010 at 10:27 am #18782


You'll get all the help you need. Did you create support tickets for these problems?

July 1, 2010 at 1:14 pm #18783


No, I haven't created any tickets as I think I need to update to WPML 1.8 to have the ticket systems included in the admin, but the last time I updated, it messed the site up so I have to back everything up but am too busy to deal with this right now.
So anyway, is there any way to have body classes based on languages? Anyone? I really really need to have it as I need to change a lot of stuff in the css based on languages and so on.

July 1, 2010 at 4:44 pm #18784


I emailed you. Please let me know if you don't get that email. I'll also ask Mihai to reply here.

July 1, 2010 at 4:58 pm #18785


Hi Ragnar,
If you want to add the class manually in your templates you can use the ICL_LANGUAGE_CODE constant.
To have it added automatically you need to add these lines to your functions.php file in the theme folder:

add_filter('body_class', 'append_language_class');
function append_language_class($classes){
  $classes[] = ICL_LANGUAGE_CODE;  //or however you want to name your class based on the language code
  return $classes;

We'll eventually add this in the plugin at some point soon since, like you mentioned, it's a very basic feature.

July 2, 2010 at 6:55 am #18786


Thank you both so much, Amir and Mihai, you can't imagine how much this helps me out.
And thank you, Amir, for sending me that email. I actually was already lurking around on iCanLocalize and found the tickets system there but wasn't entirely sure if it covers WMPL tickets, too. 🙂 Now that I know, I will use it until I manage to safely upgrade the plugin.
Thanks guys for help! 🙂

July 2, 2010 at 1:59 pm #18787


Hello guys,
I can see You just solved an issue I am trying to find out too.
I am not experienced in PHP and I´m a wordpress beginner so it is a bit more complicated for me.
I added this code posted by Mihai:
add_filter('body_class', 'append_language_class');
function append_language_class($classes){
$classes[] = ICL_LANGUAGE_CODE; //or however you want to name your class based on the language code
return $classes;
to functions.php in my theme folder (almost to the end of file, just before <?php } ?>
Then I edited my CSS:
I use body_class like this (without languages): #page #menu {
background-image: url("images/menu_info.png");
So I added this for German (de_DE) version: #page #menu {
background-image: url("images/menu_info_de.png");
But I still cannot see the German menu background in German version.
Can you please tell me what I am doing wrong?
Thanks a lot and have a nice day!

July 2, 2010 at 3:35 pm #18788


Can you give your blog/site url? There could be various reasons, it's easier to figure it out with the code right under your nose 🙂

July 3, 2010 at 12:14 pm #18789


URL: hidden link
It should work just for the homepage (Info) for DE version, I have not set the others yet.
Thanks a lot!

July 3, 2010 at 5:25 pm #18790


I have the .mo file for DE just in languages folder, I don´t have .mo file in theme folder. Could this be the problem?

September 14, 2010 at 6:41 pm #18791


About adding a body class based on language, I use a hard coded variant in my header.php template and works like a charm:
<body <?php body_class(ICL_LANGUAGE_CODE); ?>>

October 6, 2010 at 6:16 am #18792


re scared to <a href="hidden link">louis vuitton replica sunglasses</a> death," Rothman said

The topic ‘[Closed] Body class based on language’ is closed to new replies.