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

Most upvoted comments

Thank you ๐Ÿ˜ƒ And out of curiosity, when are you planning this update officially at wordpress.org?

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. ๐Ÿ‘

Thank you very much ๐Ÿ˜ƒ I will try it tomorrow ๐Ÿ˜ƒ