I'm trying to include selectivizr.js inside conditional comments. What am I doing wrong here?
<!DOCTYPE html>
<html class="no-js" <?php language_attributes(); ?>>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php wp_title('|', true, 'right'); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
<!--[if (gte IE 6)&(lte IE 8)]>
<?php
function blarg(){
wp_enqueue_script('selectivizr', get_template_directory_uri() . 'assets/js/vendor/selectivizr.js');
}
add_action('wp_enqueue_scripts', 'blarg', 101);
?>
<![endif]-->
<link rel="alternate" type="application/rss+xml" title="<?php echo get_bloginfo('name'); ?> Feed" href="<?php echo esc_url(get_feed_link()); ?>">
</head>
Nothing appears between the comments. I'm using the Roots theme. They have a scripts.php where other scripts are queued. If I put the wp_enqueue_script()
in that file it works, but then I can't do the conditional comments.
UPDATE:
OK, the real challenge seems to be getting a script inside conditional comments (or any other particular HTML) will still using the queuing system. What is the best way to do that? Or is there a way?