I have a customizer column layout control (drop down) that allows you to set the number of sidebars used on all pages by default.
I also have the same drop down on the post editor (inside a metabox) so that you can override the global column layout for specific posts.
I'd like to move the 'per' page column layout drop down to the customizer but I'd need to be able to:
- Determine the current page in the preview window (i.e. is it an archive page, or single post - if so then get the post ID).
- Retrieve the column layout setting from post meta.
- Update the control setting to point to a new post ID if the preview window updates.
- Save the 'per page' column setting back to post meta.
Can anyone explain how to achieve any of the above or point to a relatively simple example that deals with extracting post meta into a customizer setting, saving it back to post meta, and can detect changes to the preview window URL?