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

Typography error: Undefined index: font-family #1916

Closed
DeoThemes opened this issue Jun 5, 2018 · 3 comments
Closed

Typography error: Undefined index: font-family #1916

DeoThemes opened this issue Jun 5, 2018 · 3 comments
Labels

Comments

@DeoThemes
Copy link

Issue description:

I had the Typography field before to select from Google fonts with a default font-family settings:

	// Headings typography control
	Kirki::add_field( 'deo_config', array(
		'type'        => 'typography',
		'settings'    => 'deo_headings_typography',
		'label'       => esc_html__( 'Headings Typography', 'meridia' ),
		'description' => esc_html__( 'Select the general headings options for your site.', 'meridia' ),
		'help'        => esc_html__( 'The typography options you set here apply to all headings on your site.', 'meridia' ),
		'section'     => 'deo_typography',
		'priority'    => 10,
		'default'     => array(
				'font-family'    => 'Raleway',
				'font-weight'    => '600',
				'line-height'    => '1.3',    
		),
		'choices'  => array(
				'variant' => array(
						'regular',
						'600',
				),
		),
		'output' => array(
				array(
						'element' => $selector['headings'],
				),
		)
	));

Now I want to keep only controls to select font size and remove Google fonts control.
After deleting this Typography control the following error is showing:
Notice: Undefined index: font-family in C:\MAMP\htdocs\wp_margin\wp-content\plugins\kirki\modules\webfonts\class-kirki-fonts-google.php on line 133

Version used:

3.0.33

Using theme_mods or options?

theme_mods

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

	// Config
	Kirki::add_config( 'deo_config', array(
		'capability'    => 'edit_theme_options',
		'option_type'   => 'theme_mod',
		'option_name'   => 'deo_config'
	) );

	// H1 control
	Kirki::add_field( 'deo_config', array(
		'type'        => 'typography',
		'settings'    => 'deo_headings_h1',
		'label'       => esc_html__( 'H1 Headings', 'margin' ),
		'section'     => 'deo_typography',
		'priority'    => 10,
		'default'     => array(
			'font-size'      => '40px'
		),
		'output' => array(
			array(
				'element' => $selector['h1'],
			),
		)
	));
@aristath
Copy link
Contributor

aristath commented Jun 6, 2018

I don't understand... If you don't want to use a font-family, then why use a typography control? If all you want to do is control the font-size then a dimension control is a lot better. Typography controls are built around the font-family selectors

@DeoThemes
Copy link
Author

DeoThemes commented Jun 7, 2018

Yes, it makes sense. But can I use output array with all h1 selectors on dimension control? Without using inline style. Seems like it's not working this way.

UPD:
Another scenario. I returned this settings that controls font-family for all headings, now I still have notice message Undefined index: font-family

@aristath
Copy link
Contributor

Closing as a duplicate of #1797, this should be working fine now in the 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