The following code snippet lets you add a class with the name of the current language to your HTML body tag. This makes it possible, for example, to change the styling specifically for the English version of your website.
function osulzer_add_language_class_to_body($classes){
if(defined(ICL_LANGUAGE_CODE)) { #check if wpml constant is present
$classes[] = 'lang-'.ICL_LANGUAGE_CODE;
return $classes;
}
}
add_filter('body_class', 'osulzer_add_language_class_to_body');
With CSS, you can then control the content, for example as follows. As an example, we simply hide the header for the German version of the site.
.lang-de header {
display:none;
}
Learn more about my services as a WordPress developer.




