| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | - * Modify the ody class in dom for translated pages | |
| 10 | + * Modify the body class in dom for translated pages | |
| 11 | 11 | * |
| 12 | 12 | * @param object $dom |
| 13 | 13 | * @param array $args |
| 14 | 14 | * @return object |
| @@ -17,11 +17,11 @@ | ||
| 17 | 17 | |
| 18 | 18 | wplng_args_setup( $args ); |
| 19 | 19 | |
| 20 | 20 | // Replace languages IDs in <body> class |
| 21 | - foreach ( $dom->find( 'body[class]' ) as $element ) { | |
| 21 | + foreach ( $dom->find( 'body' ) as $element ) { | |
| 22 | 22 | |
| 23 | - $class_array = explode( ' ', $element->class ); | |
| 23 | + $class_array = ! empty( $element->class ) ? explode( ' ', $element->class ) : array(); | |
| 24 | 24 | |
| 25 | 25 | foreach ( $class_array as $key => $class ) { |
| 26 | 26 | if ( wplng_str_is_locale_id( $class ) ) { |
| 27 | 27 | $class_array[ $key ] = $args['language_target']; |