themeum / kirki

Extending the customizer
https://kirki.org
MIT License
1.26k stars 328 forks source link

Color control not working #1665

Closed daviedR closed 6 years ago

daviedR commented 6 years ago

All my color controls suddenly not working on: WordPress 4.9 Kirki version 3.0.16

When you change the value of color control, there is error message shown in console:

Uncaught TypeError: Cannot read property 'setting' of undefined

from .../kirki/controls/js/dist/script.js?ver=3.0.16:504

Looks like the foundNode is never set, because the check if ( ! _.isUndefined( wp.customize.instance( currentNode ) ) ) never returns true.

Please help

daviedR commented 6 years ago

By the way I am using options mode.

Let's say I have a setting: my_theme_option[color_accent].

In your script, you split them to check every node. When it runs check if ( ! _.isUndefined( wp.customize.instance( currentNode ) ) ) it will always return false. Because there is no wp.customize.instance( 'color_accent' ).

The correct check is for wp.customize.instance( 'my_theme_option[color_accent]' ) instead.

I think this would work fine on theme_mods mode, as there is no split process to the setting key.

Please help

aristath commented 6 years ago

Can you please try the develop branch and let me know if it works for you now? It should be ok, I just pushed a fix for this. Using options instead of theme_mods is no something a lot of people do - and for good reason - so it doesn't get tested by many people.

Thank you for reporting this issue! Fix will be included in 3.0.17