Wordpress Bootstrap html5 wp_enqueue_style

时间:2015-04-23 07:29:19

标签: php wordpress twitter-bootstrap

我正在尝试wp_style_add_data for bootstrap for html5shiv.min.js和respond.min.js

尝试:

wp_enqueue_style( 'theme-ie', 'https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js', array( 'theme-style' ), '3.7.2' );
wp_enqueue_style( 'theme-ie-2', 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js', array( 'theme-style' ), '1.4.2' );
wp_style_add_data( 'theme-ie', 'conditional', 'lt IE 9' );
wp_style_add_data( 'theme-ie-2', 'conditional', 'lt IE 9' );

但是,如果是IE 9两次,则会添加:

<!--[if lt IE 9]>
<link rel='stylesheet' id='theme-ie-css'  href='https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js?ver=3.7.2' type='text/css' media='all' />
<![endif]-->
<!--[if lt IE 9]>
<link rel='stylesheet' id='theme-ie-2-css'  href='https://oss.maxcdn.com/respond/1.4.2/respond.min.js?ver=1.4.2' type='text/css' media='all' />
<![endif]-->

可以使用wp_style_add_data添加html5shiv并在同一个IE 9中响应脚本,或者是否需要手动添加代码到wordpress header.php?

1 个答案:

答案 0 :(得分:1)

使用script_loader_tag

user.php