Skip to content

Instantly share code, notes, and snippets.

@jpmarchand
Last active May 26, 2017 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpmarchand/f865f0b5b5fd407b48ec to your computer and use it in GitHub Desktop.
Save jpmarchand/f865f0b5b5fd407b48ec to your computer and use it in GitHub Desktop.
Load Font Awesome using MaxCDN. Source: http://www.bootstrapcdn.com/fontawesome/
<?php
//* Load Font Awesome using MaxCDN conditionally
add_action('wp_enqueue_scripts', 'customprefix_enqueue_font_awesome');
function customprefix_enqueue_font_awesome() {
if (is_category() || is_home()) {
wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
}
}
<?php
//* Load Font Awesome using MaxCDN
add_action('wp_enqueue_scripts', 'customprefix_enqueue_font_awesome');
function customprefix_enqueue_font_awesome() {
wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment