Created
February 13, 2018 12:06
-
-
Save obiPlabon/76e8a85acfc62f56c2f149b7607fc708 to your computer and use it in GitHub Desktop.
Enqueue IE (Internet Explorer) only scripts and stylesheet in WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function op_enqueue_scripts() { | |
wp_enqueue_style( | |
'op-ie8', | |
get_template_directory_uri() . '/assets/css/ie8.css', | |
array(), | |
'0.0.7' | |
); | |
wp_style_add_data( 'op-ie8', 'conditional', 'IE 8' ); | |
wp_enqueue_script( | |
'respond', | |
get_template_directory_uri() . '/assets/vendor/respond.min.js', | |
array(), | |
'0.0.7', | |
false | |
); | |
wp_script_add_data( 'respond', 'conditional', 'IE 8' ); | |
} | |
add_action( 'wp_enqueue_scripts', 'op_enqueue_scripts' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function op_enqueue_conditional_script() { | |
?> | |
<!--[if IE 8]> | |
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/assets/vendor/respond.min.js"></script> | |
<![endif]--> | |
<?php | |
} | |
add_action( 'wp_head', 'op_enqueue_conditional_script' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment