There are a few ways to speak back and forth with the customizer API. I don't think my scenario is that much f an offshoot so I will give it to you.
- I have a button in the Customizer to trigger a PHP script. It is a settingless control button. The part about it being an action and not a setting is very important. This button only controls an action for the preview pane.
- The PHP script that the button triggers via AJAX compiles CSS and returns it via the natural
- I have no way of pushing the data to a
styletag in the preview pane so that it changes the look of the site.
I have tried using
partials but they seem to be hooked to controls with settings. I have tried using
postMessage but again it seems to be linked to settings. I don't need a setting, I only need a trigger that sends data over.
The point here is that I need an action to take place in PHP with the simple click of a button. I can do it all day in AJAX normally, but transferring data from the Customizer Settings to the Customizer Preview pane with any PHP in the interim is a PAIN. Pun intended.