Support » Fixing WordPress » customizer update customizer panel live preview

  • Is there a way to have the customizer itself update depending on controls in the customizer. For example, I have a section that has settings and controls for a slider (page, button text, etc) and of course you can hard code the number of slides you can have in the sliders but I’m wanting to know if you can for example have a control that is the number of slides you can have. so if it currently is 3, then you have three settings and controls (one for each slide). but if you change the number of slides to something else, say 6, then the customizer would update itself so that there are 6 settings and controls for the b slides.

    Any suggestions…

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz


    It’s possible provided your customizer code has saved values it can check to know how much and what to output as elements. In other words, the number of slides and their settings all need to be saved to the DB. This is essentially how the menus and the “Create a New Menu” button work. You could look at the existing menu source code for guidance on what to do.

    Thread Starter wc.smith


    Thanks for the suggestion. I’ll take a look at it, but I suspect it is over my head. I have the number of slides working OK, it just that once you change the number of slides you have to publish and then go back into the slider section in the customizer to see the different number of slides available. I was hoping to streamline that a bit but seems rather complicated for something that is not done very often (ie changing the number of slides in the slider section).

    Moderator bcworkz


    The usual settings scheme has built-in mechanisms for saving values, but only when published. For interactive elements like adding more slides, that won’t do. We want to see results without publishing, so they need to be added via JavaScript or JS based frameworks. Perhaps this will help some:

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.