Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to not load FontAwesome externally #7

Open
dartrax opened this issue Jul 1, 2020 · 2 comments
Open

Option to not load FontAwesome externally #7

dartrax opened this issue Jul 1, 2020 · 2 comments

Comments

@dartrax
Copy link

dartrax commented Jul 1, 2020

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.

@yunusga
Copy link

yunusga commented May 13, 2021

function wps_deregister_styles(){
    wp_dequeue_style( 'wcssc-font-awesome' );
}
add_action( 'wp_enqueue_scripts', 'wps_deregister_styles', 100 );

@dartrax
Copy link
Author

dartrax commented May 13, 2021

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 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants