Add langauge_attributes() template tag. #3136
git-svn-id: https://develop.svn.wordpress.org/trunk@4218 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b5ffe203a4
commit
a52b67b3d4
@ -13,7 +13,7 @@ get_admin_page_title();
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php bloginfo('text_direction'); ?>" lang="<?php bloginfo('language'); ?>" xml:lang="<?php bloginfo('language'); ?>">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
|
||||
<title><?php bloginfo('name') ?> › <?php echo $title; ?> — WordPress</title>
|
||||
|
@ -129,15 +129,11 @@ function get_bloginfo($show='') {
|
||||
break;
|
||||
case 'language':
|
||||
$output = get_locale();
|
||||
if ( empty($output) )
|
||||
$output = 'en-US';
|
||||
$output = str_replace('_', '-', $output);
|
||||
break;
|
||||
case 'text_direction':
|
||||
global $wp_locale;
|
||||
$output = $wp_locale->text_direction;
|
||||
if ( empty($output) )
|
||||
$output = 'ltr';
|
||||
break;
|
||||
case 'name':
|
||||
default:
|
||||
@ -870,4 +866,15 @@ function the_search_query() {
|
||||
echo wp_specialchars( stripslashes($s), 1 );
|
||||
}
|
||||
|
||||
function language_attributes() {
|
||||
$output = '';
|
||||
if ( $dir = get_bloginfo('text_direction') )
|
||||
$output = "dir=\"$dir\"";
|
||||
if ( $lang = get_bloginfo('language') ) {
|
||||
if ( $dir ) $output .= ' ';
|
||||
$output .= "lang=\"$lang\" xml:lang=\"$lang\"";
|
||||
}
|
||||
|
||||
echo $output;
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user