I have a customizer RadioControl with 3 choices: menu-left, menu-right, menu-top
. I want the chosen setting to be added to the body as a class, while the others are removed.
Example
<body class="class1 menu-left">
will become <body class="class1 menu-right">
In order to do that, I want to read the choices dynamically in preview. Yet, the wp.customize.control
does not work in a script enqueued in customize_preview_init
-action.
I would love to:
const choices = Object.keys(wp.customize( controlKey ).params.choices).join(" ");
How can I read a controls available choices in preview?