fixes #37 -- adding language_attributes() in header.php

This commit is contained in:
Ben Word
2011-04-28 13:52:43 -06:00
parent a39bc3d5e3
commit edf5b263fb
2 changed files with 29 additions and 11 deletions

View File

@@ -1,8 +1,8 @@
<!doctype html> <!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]--> <!--[if lt IE 7]> <html class="no-js ie6" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]--> <!--[if IE 7]> <html class="no-js ie7" <?php language_attributes(); ?>> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js ie8" <?php language_attributes(); ?>> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]-->
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">

View File

@@ -103,6 +103,24 @@ function roots_relative_feed_urls() {
add_action('pre_get_posts', 'roots_relative_feed_urls' ); add_action('pre_get_posts', 'roots_relative_feed_urls' );
// remove dir and set lang="en" as default (rather than en-US)
function roots_language_attributes() {
$attributes = array();
$output = '';
if (!defined('WP_LANG')) {
$attributes[] = "lang=\"en\"";
} else if ($lang = get_bloginfo('language')) {
$attributes[] = "lang=\"$lang\"";
}
$output = implode(' ', $attributes);
$output = apply_filters('roots_language_attributes', $output);
echo $output;
}
add_filter('language_attributes', 'roots_language_attributes');
// remove WordPress version from RSS feed // remove WordPress version from RSS feed
function roots_no_generator() { return ''; } function roots_no_generator() { return ''; }
add_filter('the_generator', 'roots_no_generator'); add_filter('the_generator', 'roots_no_generator');