Ticket #12135: general-template.php.diff

File general-template.php.diff, 995 bytes (added by shidouhikari, 3 years ago)

Adds support for XHTML 1.1 in <html> attributes

Line 
1Index: wp-includes/general-template.php
2===================================================================
3--- wp-includes/general-template.php    (revision 13164)
4+++ wp-includes/general-template.php    (working copy)
5@@ -1884,11 +1884,15 @@
6                $attributes[] = "dir=\"$dir\"";
7 
8        if ( $lang = get_bloginfo('language') ) {
9-               if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
10-                       $attributes[] = "lang=\"$lang\"";
11-
12-               if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
13+               // if doctype is passed as xhtml, use only xml:lang, that is supported by all XHTML versions
14+               if ( $doctype == 'xhtml' )
15                        $attributes[] = "xml:lang=\"$lang\"";
16+               // if MIME is not text/html, use xml:lang too
17+               elseif ( get_option('html_type') != 'text/html' )
18+                       $attributes[] = "xml:lang=\"$lang\"";
19+               // if doctype is not passed as xhtml and MIME is text/html, then use lang
20+               else
21+                       $attributes[] = "lang=\"$lang\"";
22        }
23 
24        $output = implode(' ', $attributes);