#34769 closed feature request (invalid)
Function in register_sidebar do not change value in customizer
Reported by: | rinkuyadav999 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.3.1 |
Component: | Customize | Keywords: | has-screenshots close |
Focuses: | Cc: |
Description
Hi
I have a function mytheme_dynamic_panel in before_widget like:
'before_widget' => '<div id="%1$s" class=" '. mytheme_dynamic_panel() . ' widget_sidebar_main clearfix %2$s">',
Actually it changes class base on user input through customizer. it works fine when i save options and visit live website.
But it do not work in live customize preview.
Thank you
Regards
Rinku Y
Attachments (1)
Change History (6)
#2
@
9 years ago
Yes i know about postMessage.
I will use 'transport' => 'postMessage', for this option. However this should also work for 'transport' => 'refresh', . Because 'transport' => 'refresh', is default and it should work in customize. I do not care about page refresh.
Please think better for it.
Thank you
Regards
Rinku Y
#3
@
9 years ago
- Keywords close added; reporter-feedback removed
- Resolution set to invalid
- Status changed from new to closed
refresh
means that the change is not applied until the preview is refreshed. If you want the preview to update without a refresh you must use the postMessage
option and you must implement the JavaScript to update the preview or it will not work. WordPress has no way of knowing what element in your theme must be updated without the JavaScript implementation so a refresh is needed to render the page with the change intact.
Hi Rinku,
Can you share the code that you're using to create your option(s)?
There are two options for the
transport
setting,postMessage
andrefresh
, if you're usingrefresh
then your preview will not live update.Here's how it works in the twentyfifteen theme:
And the Javascript that makes it happen, from the
js/customize-preview.js
file:Here's some useful documentation about the
postMessage
option: https://developer.wordpress.org/themes/advanced-topics/customizer-api/#using-postmessage-for-improved-setting-previewing