Closed AlxMedia closed 6 years ago
I can send you a theme with the issue if you want. This is the only issue holding me back updating all themes I have to Kirki.
You could do this:
Kirki::add_field( 'alx_writeup', array(
'type' => 'color',
'settings' => 'color-topbar-menu',
'label' => esc_attr__( 'Topbar Menu Color', 'writeup' ),
'description' => esc_attr__( '', 'writeup' ),
'section' => 'styling',
'default' => 'rgba(0,0,0,0)',
'transport' => 'auto',
'output' => array(
array(
'element' => '#nav-topbar.nav-container',
'property' => 'background-color',
),
)
) );
Note the output
argument there... makes the manual css output unnecessary (read more on https://aristath.github.io/kirki/docs/modules/css.html about it)
Also the use of 'transport' => 'auto',
in combination with the output
argument will live-update without a refresh. If you use output
& transport
in most of your fields it will be a lot smoother and faster for your users 😉
If you want it transparent, then using rgba(0,0,0,0)
(or any other rgba color with the alpha channel set to 0
) will do what you need.
I can send you a theme with the issue if you want.
That would make things easier 👍
Sent you a mail with one of the themes with the issue. Hopefully it makes it more clear!
Thanks for the explanation here, I'll need to learn and see what I can do. Feel free to quality check the theme and see where I do things wrong.
Were you able to reproduce the issue with the theme? I guess using rgba(0,0,0,0)
could work as a workaround, but it would be much nicer to be able to just use an empty field that resets to that when clearing the option.
Also an additional note, I only pointed out that the topbar option didn't work but forgot to say that the same applies to the other 2 fields that are empty, (https://i.imgur.com/Q9pxbVB.png) but I guess you figured that out already :-)
I didn't have time to check this out yet, I'll have some free time to check the theme and find a solution to this tomorrow. I agree, using rgba is a workaround, not a solution. And I hate workarounds. I'll get this fixed 👍
Great, thank you. 👍
Turns out this was a simple typo. Fixed in the develop branch, will be included in the next release 👍
Awesome! 👍 Merry Christmas!
Issue description:
Setting the 'color' option to empty should save it as empty, but it doesn't do that - or am I missing something? I can't get back to the cleared option no matter how I try.
https://screenshots.firefoxusercontent.com/images/45eecc91-32c6-4145-96e5-39b71d836d27.png The field above still loads a red color that I had before emptying the field.
Code example:
And this: