How do I add "is-IE" class to body if the user is on Internet Explorer?
function artist_add_ie_class() {
?>
<script>
if ( -1 !== navigator.userAgent.indexOf( 'MSIE' ) || -1 !== navigator.appVersion.indexOf( 'Trident/' ) ) {
document.body.classList.add( 'is-IE' );
}
</script>
<?php
}
add_action( 'wp_footer', 'artist_add_ie_class' );