Is it possible to get the label of a theme customizer option?

If the customizer has been bootstrapped (that is, if the customize_register action has fired), then you can look at the control itself (assuming you flip your choices array, as I think your values should be the keys and vice-versa): $price = $wp_customize->get_setting( ‘price1’ )->value(); $control = $wp_customize->get_control( ‘price1’ ); $price_text = $control->choices[ $price ]; However, … Read more

Can not sanitize select control in customize api

The add_setting logic cant find the my_theme_sanitize_select function, you need to tell it where it is: ‘sanitize_callback’ => array( $this, ‘my_theme_sanitize_select’ ), remember that your function is inside a class so it cant just be accessed, add this to your class: public function my_theme_sanitize_select( $input, $setting ) { $from_parent = my_theme_sanitize_select( $input, $setting ); return … Read more

How to immediately apply values in customizer js api

Since you are invoking the change callback directly: value.call( customize, func ); Since you’re not passing in the value, then newval will be undefined and $customStylesheet.text(newval) will do nothing. You need to pass in the value like so: value.call( customize, func, value.get() ); Nevertheless, it would be better to re-use the existing style element that … Read more

Adding widgets with Featured Image via the Customizer run hundreds of queries

The issue boils down to this bit of code in WP_Widget::display_callback(): $was_cache_addition_suspended = wp_suspend_cache_addition(); if ( $this->is_preview() && ! $was_cache_addition_suspended ) { wp_suspend_cache_addition( true ); } This gets called right before WP_Widget_Recent_Posts::widget() and its purpose is to try as best as possible for back-compat to prevent widgets previewed in the Customizer from polluting the object … Read more

Enabling Additional CSS / custom-css

Lol, coming back to my own post 3 years later looking for answers. Deactivating plugins did nothing, but ended up finding WP_Customize_Code_Editor_Control which has options for code_type. So here is a manual method for adding a proper CSS editor to a theme. This probably only useful for updating older themes that were already installed. add_action( … Read more

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