0

I'm quite green at wp js framework;

What i'm trying to achieve is that if setting 123 == a then assign setting_x to .header-banner background-color; else if setting 123 == b assign value of setting_y.

To help understand my problem better below is the code for wp customizer api

customizer-preview.js

header_option = wp.customize('123').get();
   if(header_option =="a"){
        wp.customize('setting_x', function (value){
            value.bind (function(newval){
                $('.header-banner').css('background-color', newval); 
            });
        });
   } else{
        wp.customize('setting_y' ,function (value){
            value.bind ( function (newval){
                $('.header-banner').css('background-color', newval); 
            });
        });
   }

I would appreciate an explanation as search wp debugger / codex pages didn't get me very far, hence my question here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.