Last active
December 17, 2015 21:29
-
-
Save robneu/5675050 to your computer and use it in GitHub Desktop.
Add Font Awesome With IE7 Support to WordPress using a CDN
This file contains 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 | |
/** | |
* Registers and loads font awesome | |
* CSS files using a CDN. | |
* | |
* @link http://www.bootstrapcdn.com/#tab_fontawesome | |
* @author FAT Media | |
*/ | |
add_action( 'wp_enqueue_scripts', 'prefix_enqueue_awesome' ); | |
/** | |
* Register the awesomeness and add IE7 support | |
* | |
* @global $wp_styles | |
* @global $is_IE | |
*/ | |
function prefix_enqueue_awesome() { | |
global $wp_styles, $is_IE; | |
wp_enqueue_style( 'prefix-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/3.2.0/css/font-awesome.min.css', array(), '3.2.0' ); | |
if ( $is_IE ) { | |
wp_enqueue_style( 'prefix-font-awesome-ie', '//netdna.bootstrapcdn.com/font-awesome/3.2.0/css/font-awesome-ie7.min.css', array('prefix-font-awesome'), '3.2.0' ); | |
// Add IE conditional tags for IE 7 and older | |
$wp_styles->add_data( 'prefix-font-awesome-ie', 'conditional', 'lte IE 7' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment