Javascript 在Wordpress插件中包含条件语句的js

Javascript 在Wordpress插件中包含条件语句的js,javascript,css,wordpress,Javascript,Css,Wordpress,我必须在wordpress插件中包含一个样式表和js,这是我根据wordpress插件标准开发的。 如何将这行代码添加到前端,这取决于浏览器类型。 对于我包含的其他样式,我使用了wp_register_样式和wp_enqueue_样式函数。 但在这个特殊情况下,我有疑问 <!--[if lt IE 9]> <link href="<?php echo plugins_url('/plugin_name/js/htmlxx.css'); ?>" rel="

我必须在wordpress插件中包含一个样式表和js,这是我根据wordpress插件标准开发的。 如何将这行代码添加到前端,这取决于浏览器类型。 对于我包含的其他样式,我使用了wp_register_样式和wp_enqueue_样式函数。 但在这个特殊情况下,我有疑问

 <!--[if lt IE 9]>   
  <link href="<?php echo plugins_url('/plugin_name/js/htmlxx.css'); ?>" rel="stylesheet" type="text/css" />

 <![endif]--> 

有谁能给我一些建议吗


更新--

我想知道如何在wordpress插件中为javascript添加条件语句

function your_plugin_register_scripts() {
  global $wp_styles; // use global $wp_styles to add conditional wrapper.
  if (!is_admin()) {
    wp_register_style( 'main-style', '/path/to/your/css/style.css', array(), '', 'all' );
    wp_enqueue_style( 'main-style' );
    $wp_styles->add_data( 'main-style', 'conditional', 'lt IE 9' );

  }
}

add_action( 'wp_enqueue_scripts', 'your_plugin_register_scripts' ); 

在脚本的情况下如何使用它?@user3230561哪个脚本?我的意思是,如果我必须在lt IE 9条件下加载javascript文件,那么我应该怎么做?@user3230561相同。只需将wp_register_style()替换为wp_register_script()。$wp_styles->add_data()方法添加了条件包装器,因此无论您是使用脚本还是样式都无关紧要。我遵循了以下步骤,但是。。我可以看到在firefox浏览器中也添加了脚本,这本不应该发生,对吗?