Updated language attributes to work nicely with qTranslate - fixes #80

This commit is contained in:
Scott Walkinshaw
2011-07-11 12:55:11 -06:00
parent a87574c6ae
commit 4192053c3b

View File

@@ -132,15 +132,16 @@ add_action('pre_get_posts', 'roots_relative_feed_urls' );
function roots_language_attributes() {
$attributes = array();
$output = '';
if (!defined('WP_LANG')) {
$attributes[] = "lang=\"en\"";
} else if ($lang = get_bloginfo('language')) {
$attributes[] = "lang=\"$lang\"";
}
$lang = get_bloginfo('language');
if ($lang && $lang !== 'en-US') {
$attributes[] = "lang=\"$lang\"";
} else {
$attributes[] = 'lang="en"';
}
$output = implode(' ', $attributes);
$output = apply_filters('roots_language_attributes', $output);
echo $output;
return $output;
}
add_filter('language_attributes', 'roots_language_attributes');