在 functions.php 中添加 HTML5 Shim

Avatar of Chris Coyier
Chris Coyier

最好保持 header.php 文件整洁,并从 functions.php 文件中插入 shim。

// add ie conditional html5 shim to header
function add_ie_html5_shim () {
    echo '<!--[if lt IE 9]>';
    echo '<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>';
    echo '<![endif]-->';
}
add_action('wp_head', 'add_ie_html5_shim');

shim 用于使 HTML5 元素能够在低于 IE9 版本的 Internet Explorer 中通过 CSS 进行样式设置。