Option to not load FontAwesome externally
Opened this issue · 2 comments
I noticed an additional request to use.fontawesome.com when on cart page or saved cart page. This is problematic for me, because in this case the customers IP will be exposed to a company outside of the EU. Because of the EU General Data Protection Regulation, I would need to inform customers about this.
Also this request is not always necessary. In my case, all fonts I use are within the child themes font directory, and fontawesome is one of them. Other plugins like WPForo have an option to disable their own Font Awesome integration and the styles are automatically using the sidewide existing one. So I'd like to have an option to disable loading of an additional fontawesome integration.
function wps_deregister_styles(){
wp_dequeue_style( 'wcssc-font-awesome' );
}
add_action( 'wp_enqueue_scripts', 'wps_deregister_styles', 100 );
Hi @yunusga,
thanks for sharing!
I've added some lines to enqueue the local fontawesome style, may be you could have a look if I've done it 'the right way':
function wps_deregister_styles(){
wp_dequeue_style( 'wcssc-font-awesome' );
$currentPageTemplate = basename(get_page_template());
if ( $currentPageTemplate == 'page-cart.php' || $currentPageTemplate == 'page-my-account.php' ) {
wp_enqueue_style( 'wcssc-dartrax-font-awesome', get_stylesheet_directory_uri().'/fonts/fontawesome/css/all.min.css', array(), false );
}
}
add_action( 'wp_enqueue_scripts', 'wps_deregister_styles', 100 );