kirki: Kirki_Fonts_Google::$force_load_all_variants doesn't work anymore
Issue description:
Force loading Google Font variants doesn’t work after 3+ with code bellow. I used it for body font, so the user can use regular, bold, italic in post editor. I believe that multi-select variant would be really proper solution.
Version used:
3.0.4
Using theme_mods or options?
theme_mods
Code to reproduce the issue (config + field(s))
add_action( 'wp', function() {
if ( class_exists( 'Kirki_Fonts_Google' ) ) {
Kirki_Fonts_Google::$force_load_all_variants = true;
}
});
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (3 by maintainers)
@aristath - I’m afraid that loading all variants is actually not working, after all … At least when hooked to
after_setup_theme… Perhaps another hook ? “init” or … ? I don’t understand how you don’t see the relevance of loading multiple variants per typography control. When someone writes a blog post, it’s very common thing that he/she wants to use bolds, italics or other variants to emphasize or quote or whatever - that’s why you have “the editor” (with “Bold”, “Italic” buttons …). If you make choice to use “typography” control for body text, and be able to choose only one variant, for example “400”, the bolds, italics (available for font, for example “Roboto”), won’t display (properly). As it does not to me … Off course, loading all variants for all typography controls is surely heavy to load, but leaving users without possibility to make different font weights/styles in posts, pages …Like I already said before - adding multiselect capability to “variant” field would be effective - for example - for headings the use can pick only ONE variant (bold, for example), and for body can pick :400,400 italic, 800, 800italic. That actually would increase load time, but not nearly as much as loading all variants …
@Micemade, Indeed, it would be better, for example I do not use 800, 900 and I do not need them to load too.
@Micemade I will think more about your idea. Maybe it will available in next version.
Wow, man - great ! I will surely check it ! Thanks for sharing … 😃
I have a plugin (add on for Kirki) allow load all or multiple variants. Download: https://wordpress.org/plugins/customize-kirki-variants/
Hope this plugin useful for you.
@xttn some questions:
after_setup_theme?Sorry, I wasn’t able to reply sooner - I was away from computer. It seems it works ( I see you already included fix in wp.org update ). Thank you very much.
Yes, that works ! Thank you very much @vlthemes ! Although I have tried with “after_setup_theme”, but I didn’t include
Kirki_Fonts_Google::$force_load_all_subsets = true… Thought it wasn’t necessary, because I just wanted all variants, not subsets … Anyhow, big thanks !