Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidperezgar/0a2be0537a070a95804c to your computer and use it in GitHub Desktop.
Save davidperezgar/0a2be0537a070a95804c to your computer and use it in GitHub Desktop.
Add Font Awesome With IE7 Support to WordPress using a CDN
<?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