ControlledChaos of Controlled Chaos Design
8/9/2016 - 6:44 PM

Do something if the visitor is using Internet Explorer.

Do something if the visitor is using Internet Explorer.

<?php

$IE6 = ( preg_match( 'MSIE 6', $_SERVER['HTTP_USER_AGENT'] ) ) ? true : false;
$IE7 = ( preg_match( 'MSIE 7', $_SERVER['HTTP_USER_AGENT'] ) ) ? true : false;
$IE8 = ( preg_match( 'MSIE 8', $_SERVER['HTTP_USER_AGENT'] ) ) ? true : false;

if ( ($IE6 == 1) || ($IE7 == 1) || ($IE8 == 1) ) { ?>
  
  <p>You are using IE 8 or lower</p>

<?php } else { ?>
  
  <p>You are using a modern browser</p>
      
<?php } ?>

If IE

WordPress Snippet