admin管理员组文章数量:1130349
I am building controls (a) that are generated using a value from a control (b) in another section.
However, unless the full customize page is refreshed then then there doesn’t seem to be a way to update (a) when (b) changes. Is there a solution for this use-case?
I am building controls (a) that are generated using a value from a control (b) in another section.
However, unless the full customize page is refreshed then then there doesn’t seem to be a way to update (a) when (b) changes. Is there a solution for this use-case?
Share Improve this question asked Nov 9, 2018 at 16:49 Danny CooperDanny Cooper 3302 silver badges12 bronze badges 1- very similar to my question: wordpress.stackexchange/questions/293902/… – Joy Reynolds Commented Jan 10, 2019 at 21:43
1 Answer
Reset to default 1It depends what "update" means.
If you want just to hide or show the control, (like how WordPress sidebar area is appearing and disappearing when the sidebar is present or not) then you can use the active_callback parameter of the customize_control like this.
Edit: Also, active_callback works on sections and panels too.
If you want the change the control's HTML structure, or text or anything else, then it requires advanced javascript knowledge, because you need to trigger javascript events from the previewer and catch them on the panel. This example comment should be enough for this case.
I am building controls (a) that are generated using a value from a control (b) in another section.
However, unless the full customize page is refreshed then then there doesn’t seem to be a way to update (a) when (b) changes. Is there a solution for this use-case?
I am building controls (a) that are generated using a value from a control (b) in another section.
However, unless the full customize page is refreshed then then there doesn’t seem to be a way to update (a) when (b) changes. Is there a solution for this use-case?
Share Improve this question asked Nov 9, 2018 at 16:49 Danny CooperDanny Cooper 3302 silver badges12 bronze badges 1- very similar to my question: wordpress.stackexchange/questions/293902/… – Joy Reynolds Commented Jan 10, 2019 at 21:43
1 Answer
Reset to default 1It depends what "update" means.
If you want just to hide or show the control, (like how WordPress sidebar area is appearing and disappearing when the sidebar is present or not) then you can use the active_callback parameter of the customize_control like this.
Edit: Also, active_callback works on sections and panels too.
If you want the change the control's HTML structure, or text or anything else, then it requires advanced javascript knowledge, because you need to trigger javascript events from the previewer and catch them on the panel. This example comment should be enough for this case.
本文标签: customizationRefresh Customize Section (not preview)
版权声明:本文标题:customization - Refresh Customize Section (not preview) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749178755a2328244.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论