Search code examples
phpwordpresspluginsapplication-cache

Wordpress <html>-Tag hook/filter?


Im writing a application cache plugin for Wordpress.
I was wondering how i can modify the <\html> tag in the current theme from my plugin to:

<\html manifest="Site_url().../plugin/bla.php?var1=foo&var2=bar">

I was googling and looking up stuff on the wordpress' dev site, but no luck yet.

I appreciate any help (:

Best, m


Solution

  • You can try language_attributes. This assumes that they have followed wordpress theme standards and their header includes the following:

    <!--[if IE 6]>
    <html id="ie6" <?php language_attributes(); ?>>
    <![endif]-->
    <!--[if IE 7]>
    <html id="ie7" <?php language_attributes(); ?>>
    <![endif]-->
    <!--[if IE 8]>
    <html id="ie8" <?php language_attributes(); ?>>
    <![endif]-->
    <!--[if !(IE 6) | !(IE 7) | !(IE 8)  ]><!-->
    <html <?php language_attributes(); ?>>
    <!--<![endif]-->
    

    Example of the filter:

    function jrod_add_html_manifest( $output ) {
    
        $output .= ' manfiest="Site_url().../plugin/bla.php?var1=foo&var2=bar"';
    
        return $output;
    }
    
    add_filter( 'language_attributes', 'jrod_add_html_manifest' );