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

kirki enqueues google font even if it's not in use #1297

Closed
mapsteps opened this issue Apr 20, 2017 · 2 comments
Closed

kirki enqueues google font even if it's not in use #1297

mapsteps opened this issue Apr 20, 2017 · 2 comments
Milestone

Comments

@mapsteps
Copy link
Contributor

Issue description:

Hey there,

I use Roboto as the default font for the typography fields. Users are able to switch on typography options (with a toggle field) though. I'd like to prevent kirki loading the default google font if it's not actually in use. I think a workaround would be to check if one of the typography fields exists - and if not dequeue the font by myself. Not sure how complex it would be to do a check like this by default.

Great work btw!

Version used:

development

@aristath
Copy link
Contributor

You mean you have a setting that users can enable if they want to enable google fonts?
If that's the case, then you could disable google fonts when the checkbox is disabled by doing something similar to this:

if ( false === get_theme_mod( 'my_checkbox' ) ) {
    add_filter( 'kirki/enqueue_google_fonts', '__return_empty_array' );
}

@aristath aristath modified the milestone: 3.0 Apr 21, 2017
@mapsteps
Copy link
Contributor Author

Exactly what I was looking for, thanks! Keep up the great work!

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

No branches or pull requests

2 participants