We are taught to place the following script in the <head> section, conditional to IE 9.
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
As in WordPress I tend to use wp_enqueue_script() to hook scripts to wp_head() (default) or wp_footer(). My question is:
(1) can we implement something like the following in functions.php in WordPress theme?
function project_scripts(){?>
<!--[if lt IE 9]>
<?php
wp_enqueue_script( 'IE-scripts', 'http://html5shiv.googlecode.com/svn/trunk/html5.js' );
?>
<![endif]-->
<?php
}
add_action( 'wp_enqueue_scripts', 'project_scripts' );
(2) If so, can I do it otherwise:
function project_scripts(){
echo '<!--[if lt IE 9]>';
wp_enqueue_script( 'IE-scripts', 'http://html5shiv.googlecode.com/svn/trunk/html5.js' );
echo '<![endif]-->';
}
add_action( 'wp_enqueue_scripts', 'project_scripts' );