-
StackOverflow 文件
-
WordPress 教程
-
排隊指令碼
-
僅為 IE 排隊指令碼
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles_and_scripts' );
/**
* Enqueue scripts (or styles) conditionally.
*
* Load scripts (or stylesheets) specifically for IE. IE10 and above does
* not support conditional comments in standards mode.
*
* @link https://gist.github.com/wpscholar/4947518
* @link https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx
*/
function enqueue_my_styles_and_scripts() {
// Internet Explorer HTML5 support
wp_enqueue_script( 'html5shiv',get_template_directory_uri().'/js/html5shiv.js', array(), '3.7.3', false);
wp_script_add_data( 'html5shiv', 'conditional', 'lt IE 9' );
// Internet Explorer 8 media query support
wp_enqueue_script( 'respond', get_template_directory_uri().'/js/respond.js', array(), '1.4.2', false);
wp_script_add_data( 'respond', 'conditional', 'lt IE 9' );
}