Theme Customizer – Nested Sections?

There is no core customizer behavior that supports nested sections. However, you can roll your own customizer control which contains its own accordion sections and other controls. Keep in mind that each control relates to exactly one theme_mod variable, so my suggestion would be to implement a fairly generic control that is collapsible and contain … Read more

Theme Customizer : how to create multiple-level panel

For anyone that comes here looking for this, I was able to do it after battling with it for a few hours. The code is a bit extensive so did not want to post here, (mods feel free to let me now if that would be better), instead I created a gist: https://gist.github.com/OriginalEXE/9a6183e09f4cae2f30b006232bb154af What it … Read more

Changes in widget customizer not triggering ‘save and publish’

I was experiencing a similar problem with one of my custom widgets. It seems that dynamically inserted field values do not trigger the widget form to update. I wound up adding the following to the js that inserts the dynamic value: $(input).trigger(‘change’); where input is the field you are updating. Not sure if there is … Read more

Is there any way to add placeholder for WordPress Customizer text input fields

You can use the input_attrs argument to pass attributes to the input: $wp_customize->add_control(‘directorist_address’, array( ‘label’ => __(‘Address’, ‘directorist’), ‘section’ => ‘directorist_contact’, ‘settings’ => ‘directorist_address’, ‘description’ => __(‘Enter your contact address. Eg. Abc Business Center, 123 Road, London, England’, ‘directorist’ ), ‘input_attrs’ => array( ‘placeholder’ => __( ‘Placeholder goes here…’, ‘directorist’ ), ) ) );

Different customizer previewUrls per section

You could use active_callback property to delegate section visibility depending on current preview screen. $wp_customize->add_section( ‘my-section’, array( ‘title’ => __( ‘Section Title’ ), ‘active_callback’ => ‘is_shop’, ) ); Or custom $wp_customize->add_section( ‘my-section’, array( ‘title’ => __( ‘Section Title’ ), ‘active_callback’ => ‘is_custom_condition’, ) ); function is_custom_condition(){ $condition_is_met = //Some boolean returning logic; if( ! $condition_is_met … Read more