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
3.0.33
theme_mod
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,
),
),
)
);
It seems that this is a duplicate of #1916.
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.
Marking this one as a bug and adding to the 3.0.34 milestone 👍
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!
@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 https://github.com/aristath/kirki/commit/b01ba40e7cb6859e2330bb0beb962d7e3389a908) 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)
Most helpful comment
Marking this one as a bug and adding to the 3.0.34 milestone 👍