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

PHP creates notice when typography settings are used without "font-family" parameter. #1935

Closed
ghost opened this issue Jun 28, 2018 · 5 comments
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Jun 28, 2018

Issue description:

We set font-family for many elements globally, and then set other typography parameters for every element individually. We don't want set duplicate font-family parameters for every elements. How to realize this method correctly?

PHP notice:
Notice: Undefined index: font-family in E:...\kirki\modules\webfonts\class-kirki-fonts-google.php on line 133

Version used:

3.0.33

Using theme_mods or options?

theme_mod

Code to reproduce the issue (config + field(s))

Kirki::add_field( 'theme_kirki',
	array(
		'type'     => 'typography',
		'settings' => 'typography_general_text',
		'label'    => esc_attr__( 'Text', 'theme' ),
		'section'  => 'typography_general',
		'default'  => array(
			'font-family'    => 'Open Sans',
			'variant'        => 'regular',
		),
		'priority' => 20,
		'output'   => array(
			array(
				'element' => $typography_general_text,
			),
		),
	)
);

Kirki::add_field( 'theme_kirki',
	array(
		'type'     => 'typography',
		'settings' => 'typography_content_text',
		'label'    => esc_attr__( 'Text', 'theme' ),
		'section'  => 'typography_content',
		'default'  => array(
			'font-size'   => '18px',
			'line-height' => '1.5',
		),
		'priority' => 20,
		'output'   => array(
			array(
				'element' => $typography_content_text,
			),
		),
	)
);

Kirki::add_field( 'theme_kirki',
	array(
		'type'     => 'typography',
		'settings' => 'typography_content_additionaltext',
		'label'    => esc_attr__( 'Additional Text', 'theme' ),
		'section'  => 'typography_content',
		'default'  => array(
			'font-size'      => '16px',
			'line-height'    => '1.5',
		),
		'priority' => 30,
		'output'   => array(
			array(
				'element' => $typography_content_additionaltext,
			),
		),
	)
);
@ghost
Copy link
Author

ghost commented Jun 30, 2018

It seems that this is a duplicate of #1916.

@ghost ghost closed this as completed Jun 30, 2018
@ghost
Copy link
Author

ghost commented Jul 1, 2018

I have reopened this issue because dimension control does not allow to manage fonts parameters. For example, line height without units, text-transform, etc. Please, help to know, how to create font-family globally and other font parameters separately.

@ghost ghost reopened this Jul 1, 2018
@aristath aristath added this to the 3.0.34 milestone Jul 12, 2018
@aristath
Copy link
Contributor

Marking this one as a bug and adding to the 3.0.34 milestone 👍

@aristath aristath added the bug label Jul 12, 2018
@JiveDig
Copy link

JiveDig commented Aug 10, 2018

Just jumping to say that this is exactly how I want to use Kirki for typography. Defaults for body/headings, and only size/variant/line-height (not font-family) control for each individual h1/h2/h3. Looking forward to this update. The typography field is EXTREMELY powerful as-is, and this just makes it more flexible :) Thanks!

@aristath
Copy link
Contributor

@andreikorzhyts

I have reopened this issue because dimension control does not allow to manage fonts parameters. For example, line height without units,

Unitless dimension controls are now implemented in the develop branch (see commit b01ba40) and will be included in the next release. See example control in https://github.com/aristath/kirki/blob/89e34e9dfb46f338c74c512c2baf97e37cfcb1be/example.php#L375-L377

text-transform, etc.

I don't understand... what does text-transform have to do with dimension controls? You can add a radio control, radio-buttonset or any other control like that, but dimension doesn't make a lot of sense to me.

Closing as a duplicate of #1797, it is now possible to use typography controls without a font-family (develop branch)

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

No branches or pull requests

2 participants