Skip to content

Commit

Permalink
Added support for FontAwesome 5
Browse files Browse the repository at this point in the history
  • Loading branch information
CraigBowler committed Apr 14, 2018
1 parent a1de9c1 commit 0a80c9c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion CleanBuild/functions/wordpress/site-enqueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// ENQUEUE CUSTOM SCRIPTS
function custom_scripts() {
wp_enqueue_script( 'jq-link', 'https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js', array(), null, true );
//wp_enqueue_script( 'fa-link', 'https://use.fontawesome.com/{CDN ID}.js', array(), null, true );
// wp_enqueue_script( 'slick-link', 'https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js', array(), null, true );
// wp_enqueue_script( 'backstretch-script', get_stylesheet_directory_uri() . '/js/vendor/backstretch.min.js', array(), null, true );
// wp_enqueue_script( 'fancybox-script', get_stylesheet_directory_uri() . '/js/vendor/fancybox.min.js', array(), null, true );
Expand All @@ -13,8 +12,18 @@ function custom_scripts() {

// ENQUEUE CUSTOM STYLES
function custom_styles() {
// wp_enqueue_style( 'fa-link', '//use.fontawesome.com/releases/v5.0.10/css/all.css', array(), null );
wp_enqueue_style( 'site-style', get_stylesheet_directory_uri() . '/style.css', array(), filemtime( get_stylesheet_directory() . '/style.scss' ), 'all' );
}
add_action( 'wp_enqueue_scripts', 'custom_styles' );

// FILTER FONTAWESOME <STYLE> TO INCLUDE INTEGRITY AND CROSSORIGIN ATTRIBUTES
add_filter( 'style_loader_tag', 'add_fa_init_attributes', 100, 2 );
function add_fa_init_attributes( $html, $handle ) {
if ( 'fa-link' === $handle ) {
$html = str_replace( " type", "integrity='sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg' crossorigin='anonymous' type", $html );
}
return $html;
}

?>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Theses libraries are enqueued in ``` functions/wordpress/site-enqueue.php ``` bu
* Slick.js
* Backstretch
* Fancybox
* FontAwesome 4 (_Requires a CDN ID_)
* FontAwesome 5


## Company Detail Shortcodes
Expand Down

0 comments on commit 0a80c9c

Please sign in to comment.