php - Adding conditional scripts in wordpress -


how add scripts contains checking inside plugin e.g

<!--[if lt ie 9]>  <script src="<?php echo plugins_url('/js/html5shiv.js'); ?>" type="text/javascript"></script> <script src="<?php echo plugins_url('/js/css3-mediaqueries.js'); ?>" type="text/javascript"></script>  <script src="<?php echo plugins_url('/js/respond.js'); ?>" type="text/javascript"></script>    <![endif]-->   

using wp_register_script() , wp_enqueue_script('')

<?php     global $is_ie;     if ( $is_ie ) {         wp_enqueue_script( 'script', plugins_url.'/js/html5shiv.js' );         wp_enqueue_script( 'script', plugins_url.'/js/css3-mediaqueries.js' );         wp_enqueue_script( 'script', plugins_url.'/js/respond.js' );     } ?> 

or can try :

global $wp_scripts;     wp_register_script(      'html5shiv',      plugins_url.'/js/html5shiv.js',       array(),      '1.0' ); $wp_scripts->add_data( 'html5shiv', 'conditional', 'lt ie 9' ); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -