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

Multiple typography fields with different inputs #1436

Closed
hellor0bot opened this issue Jun 27, 2017 · 7 comments
Closed

Multiple typography fields with different inputs #1436

hellor0bot opened this issue Jun 27, 2017 · 7 comments
Milestone

Comments

@hellor0bot
Copy link

Issue description:

I'm using the following typography fields:

image

Thus I can change font family for all headings and only sizes for individual headings tags.

I'm using auto transport on all fields.

The issue is that font variants from the main Headings field are getting bugged when selecting sizes from the secondary fields, like Heading 1, Heading 2, etc. In the end the font variants are not getting changed in the customizer preview.

It is displayed correctly on the front end after saving though.

Most likely the issue is caused by the transport: auto, that takes up font variants from the secondary fields, even though there're no font variants (or other options) provided.

Version used:

Develop.

@aristath
Copy link
Contributor

Can you post your code?

@hellor0bot
Copy link
Author

hellor0bot commented Jun 27, 2017

Sure, sorry about that!

Kirki::add_field( 'theme_mods', array(
	'type'        => 'typography',
	'settings'    => 'typography_headings',
	'label'       => esc_html__( 'Heading', 'text-domain' ),
	'section'     => 'typography_headings',
	'default'     => array(
		'font-family'    => 'Lora',
		'variant'        => '700',
		'subsets'        => array( 'latin-ext' ),
		),
	'transport'   => 'auto',
	'priority'    => 10,
	'output'      => array(
		array(
			'element' => 'h1, h2, h3, h4, h5, h6',
			),
		),
) );


Kirki::add_field( 'theme_mods', array(
	'type'        => 'typography',
	'settings'    => 'typography_h1',
	'label'       => esc_html__( 'Heading 1', 'text-domain' ),
	'section'     => 'typography_headings',
	'default'     => array(
		'font-size'      => '3rem',
		'letter-spacing' => '-.15rem',
		'text-transform' => 'none',
		),
	'transport'   => 'auto',
	'priority'    => 10,
	'output'      => array(
		array(
			'element' => 'h1',
			),
		),
) );

Thanks for looking into this.

@aristath
Copy link
Contributor

Fixed.
And that has to be the longest condition I've written in PHP 🥇

@hellor0bot
Copy link
Author

Thanks a lot. You're a star :)

Will give it a try tomorrow.

@hellor0bot
Copy link
Author

Just tried it on my old MacBook Pro and font variants don't seem to change at all in the customizer now with transport set to auto :(

I'll test it more thoroughly tomorrow.

aristath added a commit that referenced this issue Jun 27, 2017
@aristath
Copy link
Contributor

aristath commented Jun 27, 2017

Fixed 👍
There was a logic error in the condition ( || instead of && at some point).

@aristath aristath added this to the 3.0.8 milestone Jun 27, 2017
@hellor0bot
Copy link
Author

Working fine now! Many thanks.

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

No branches or pull requests

2 participants