• I’m trying to make an XHTML 1.1 theme. I’m using the “language_attributes” function in the header, as recommended.

    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes('xhtml'); ?>>

    However, this produces the following.

    <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en-US">

    “lang” is invalid markup in XHTML 1.1 – only “xml:lang” is allowed.

    Is there anyway of having WordPress return the correct attributes? I could modify the language_attributes function to be able to take an “xhtml 1.1” attribute, but I’d prefer not to mod the WordPress code, as it’s a pain when updating.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The function calls a filter just before outputting to the browser so you should be able to use that to remove the offending attribute.

    Thread Starter robot-armadillo

    (@robot-armadillo)

    Thanks. That worked a treat…after I dusted off my old PHP skills.

    Could you give here an example for such a filter?
    Thanks

    The correct way to parse the language in that meta tag is as simple as this:

    <meta http-equiv=”Content-language” content=”<?php bloginfo(‘language’); ?>” />

    Sorry think I was too quick there, the correct headers should be:

    <html xmlns=”http://www.w3.org/1999/xhtml&#8221; dir=”<?php bloginfo(‘text_direction’); ?>” xml:lang=”<?php bloginfo(‘language’); ?>”>

    <head>

    <title>The title</title>

    <meta http-equiv=”Content-Type” content=”<?php bloginfo(‘html_type’); ?>; charset=<?php bloginfo(‘charset’); ?>” />
    <meta http-equiv=”Content-language” content=”<?php bloginfo(‘language’); ?>” />

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Stop “language_attributes” producing invalid XHTML 1.1?’ is closed to new replies.