$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>customization - Refresh Customize Section (not preview)|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

customization - Refresh Customize Section (not preview)

matteradmin6PV0评论

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
Add a comment  | 

1 Answer 1

Reset to default 1

It 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.

Post a comment

comment list (0)

  1. No comments so far