kirki: css_vars font-family bug.
Hello. I found one error. When we use css_vars with font-family property, the result is bad or Iโm doing something wrong.
Code:
Kirki::add_field( 'id', [
'type' => 'typography',
'settings' => 'setting_id',
'label' => 'text',
'section' => 'section_id',
'default' => [
'variant' => 'regular',
'font-family' => 'Playfair Display',
],
'transport' => 'postMessage',
'choices' => [
'fonts' => [
'google' => [ 'popularity', 30 ],
],
'variant' => [ '300', '300italic', 'regular', 'italic', '600', '700' ],
],
'css_vars' => [
[ '--heading-font-family', '$', 'font-family' ],
],
] );
Suppose I chose Ubuntu font in Customizer.
Expected result:
<style id="kirki-css-vars">:root{--heading-font-family:Ubuntu;}</style>
Current result:
<style id="kirki-css-vars">:root{--heading-font-family:Ubuntu, ;}</style>
It adds a comma to the end of the font name. The question is whether there should be something else after this comma and I am doing something wrong or there should not be a comma at all (I think there should not be).
Greetings.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (5 by maintainers)
Commits related to this issue
- Removed backup fonts. See https://github.com/aristath/kirki/issues/2246 — committed to themeum/kirki by aristath 5 years ago
- See https://github.com/aristath/kirki/issues/2246#issuecomment-523847546 — committed to themeum/kirki by aristath 5 years ago
- see https://github.com/aristath/kirki/issues/2246 — committed to themeum/kirki by aristath 5 years ago
As soon as thereโs at least another fix in there. Right now v3.0.45 only includes the fix for this ticket - in other words a fix for an issue that nobody else has ever reported, so chances are it has something to do with your specific setup. This change is minor and wonโt affect anyone but you. Iโd like to add something else in there too, so Iโm hoping Iโll add some other bugfixes this weekend and release a more complete update. ๐
These lines: https://github.com/aristath/kirki/blob/d502fcf7a50a0663cb316721bc9e6479fdf1050c/core/class-kirki-values.php#L48-L52 replace them with this: https://github.com/aristath/kirki/blob/20ce2a6d8184f333b0a72a78141cf2183ca02fe3/core/class-kirki-values.php#L48-L55 The fix has been pushed in this branch: https://github.com/aristath/kirki/tree/3045 so you can just take the file from there if you want ๐
Thank you very much ๐ I will try it tomorrow ๐