-
Notifications
You must be signed in to change notification settings - Fork 329
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
Typography Variants (weights) #885
Comments
We were never force-loading ALL variants... the only one that was being loaded in addition to the selected font-weight was the bold (700). Try adding these 2 lines (using the latest Kirki_Fonts_Google::$force_load_all_variants = true;
Kirki_Fonts_Google::$force_load_all_subsets = true; Let me know if that works! |
Thank you, but what we really want is to be able to select multiples font variants, similar to multiselect for subsets. Can we do that somehow? |
@getbowtied, you could give |
I'm afraid not. Not because it can't be done, but because conceptually it doesn't fit the customizer's philosophy. Since an element can only have a single font-weight, I can only assume that the controls are not tied to a specific element. So, why would you want to allow selecting multiple variants if they are not assigned anywhere? If there are multiple font-weighs selected, then the output of a typography field for example will get really messy... |
Let say we assign a typography globally to BODY. Let's say Roboto. Then we need some selectors to show weight 100, other weight 900. |
In that case, you just add another typography control for that selector... and this way the user has the freedom to choose what font-family as well as font-weight they want to use for that... |
Let me give another example. We assign a typography to a |
Sorry. Let me give another example. We assign a typography to a "p". Inside that "p" we have "strong" and "em". If we cannot select multiple weights, how those strong's and em's will show the right font variants? |
If you want to load normal, bold, normal-italic and bold-italic then why not just load all of them using the 2 lines I posted earlier? Agreed, it's not ideal. But the extra overhead will be minimal... |
Ok, thank you! |
Where are these two lines added using the plugin?
I want the user to pick a body font and just like with Google fonts in general, b, strong, em will use Google's CSS to assign and if not, well it will look bad, so I would give instructions to use only certain fonts. Thanks! |
Anywhere you like. :) You can just add in your function my_theme_load_all_variants_and_subsets() {
if ( class_exists( 'Kirki_Fonts_Google' ) ) {
Kirki_Fonts_Google::$force_load_all_variants = true;
Kirki_Fonts_Google::$force_load_all_subsets = true;
}
}
add_action( 'after_setup_theme', 'my_theme_load_all_variants_and_subsets' ); |
Thanks! I added this with the latest update to the plugin and I still don't get the variants or the subsets, it should read : ... |
@carasmo fixed in the develop branch. Please note that if you force-load all variants and subsets using the above, the subset & variant sub-fields in typography controls will be hidden. |
Thanks! It's working now. Is this going to be part of the plugin version or the library version? Thanks again! |
For now just the plugin. |
I have a plugin (add on for Kirki) allow load all or multiple variants. Hope this plugin useful for you. |
Issue description:
We have used this method to load google fonts:
and the output was
http://screencast.com/t/iQxJEtUxX
(with all weights available) [Kirki 2.0.5]
Now we have updated to 2.3.0 and with the same method the output is:
http://screencast.com/t/hIZo0N3ud3Q
(WITHOUT weights)
We have tried also the typography field (https://kirki.org/docs/controls/typography.html),
but the problem is we cannot select multiple weights (variants).
The question is: how we can load multiple weights for a font?
Version used:
2.3.0
Using theme_mods or options?
theme_mods
Code to reproduce the issue (config + field(s))
The text was updated successfully, but these errors were encountered: