Add WPML language classes to body in WordPress

Add this code snippet to functions.php file of active WordPress theme

//Add language classes to body
add_filter('body_class', 'add_language_classes');
function add_language_classes($classes){
  $classes[] = "lang-".ICL_LANGUAGE_CODE; 
  return $classes;
Need a helping hand in fixing your website issues?

If you are facing any problems in implementing these code snippets and tutorials, you can hire us to fix your website issues.

Hire Us