Add or remove HTML class with selective refresh?

Yes. This can be accomplished by creating a custom selective refresh Partial type, and overriding the refresh method in the JavaScript class. Here’s the relevant JavaScript which should get enqueued in the Customizer preview, with customize-selective-refresh as its script dependency: wp.customize.selectiveRefresh.partialConstructor.body_class = wp.customize.selectiveRefresh.Partial.extend({ /** * Class name choices. * * This is populated in PHP … Read more

How to get control choices from $setting object passed to sanitize_callback

This is correct: $control = $setting->manager->get_control($setting->id); $choices = $control->choices; However, in your example, $setting->id will be theme_oenology_options[name]. So, get_control(‘theme_oenology_options[name]’) will return null because there’s no control with that name. You gave the control the id of oenology_name instead. I always give the same ID to settings and their matching controls for that reason.

Is it possible to conditionally displaying and hiding of customizer controls for each device preview?

I’m not familiar working with Kikri, but I’ve made a standalone example plugin that shows the approach I’d use to get controls to be contextual based on the previewed device. The plugin adds colored outlines around each element in the site, with a different color for elements in desktop, tablet, and mobile (obviously just for … Read more

Customiser `active_callback` not working on control with `postMessage` transport method

Because postMessage uses JavaScript entirely, any PHP active_callback will not get called unless the preview refreshes (e.g. via wp.customize.previewer.refresh()). So what you need to do is implement the active callback in JavaScript instead, like so: wp.customize.bind( ‘ready’, function () { wp.customize.control( ‘archive_show_more_link’, function( control ) { var setting = wp.customize( ‘archive_link_tile_size’ ); control.active.set( ‘large’ === … Read more

How do I conditionally enqueue stylesheets or scripts in theme customizer settings?

Got it! Here’s the code that worked for me. — Theme Customizer settings and controls (mine are in a separate customizer.php file): function themename_customize_register( $wp_customize ) { … $wpcustomize->add_setting( ‘themename_skin’, array( ‘default’ => ‘light’, ), ); $wp_customize->add_control( ‘themename_skin’, array( ‘label’ => ‘Skin’, ‘section’ => ‘colors’, ‘settings’ => ‘themename_skin’, ‘type’ => ‘radio’, ‘choices’ => array( ‘light’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)