How to execute conditional script when on new customize.php (Theme Customize) screen

Okay, first, let’s set things up properly, with a callback hooked into an appropriate action hook: <?php function wpse55227_enqueue_scripts() { // Enqueue code goes here } add_action( ‘wp_head’, ‘wpse55227_enqueue_scripts’ ); ?> We’ll put all of our code in to this callback. The next step is to add our if ( ! is_admin() ) conditional wrapper: … Read more

How to print the value of a custom control in the Customizer?

Your code is perfect just need to change ‘theme_mod’ instead of ‘option’ it will solve this. function themename_customize_register($wp_customize){ $wp_customize->add_setting( ‘test_setting’, array( ‘default’ => ‘value_xyz’, ‘capability’ => ‘edit_theme_options’, ‘type’ => ‘theme_mod’, )); $wp_customize->add_control( ‘test_control’, array( ‘label’ => __(‘Text Test’, ‘themename’), ‘section’ => ‘spacious_slider_number_section1’, ‘settings’ => ‘test_setting’, )); } add_action(‘customize_register’, ‘themename_customize_register’); And to retrieve it get_theme_mod( ‘test_setting’ … Read more

Editing the custom background CSS

Yes, that is possible. Take a look at the codex and you will see that you can pass arguments with add_theme_support( ‘custom-background’). One of them is the callback function that generates the <style> tags: _custom_background_cb. You can pass your own function as an argument to add_theme_support. Here is the code of the original function (retrieved … Read more

Remove Customize Background and Header from Appearance admin menu without CSS or JS

As overcomplicated as it sounds, I always find the best way to handle admin menu modifications is to overlook the given wordpress remove_ functions and go straight to the $menu and $submenu globals. In the case you’ve specified here, you’d want to change your code to: add_action(‘admin_menu’, ‘remove_unnecessary_wordpress_menus’, 999); function remove_unnecessary_wordpress_menus(){ global $submenu; unset($submenu[‘themes.php’][20]); unset($submenu[‘themes.php’][22]); … Read more

How to refresh Theme Customizer after change color inside wpColorPicker?

Try using the existing WordPress function to modify color palette like: function my_mce4_options( $init ) { $default_colours=” “000000”, “Black”, “993300”, “Burnt orange”, “333300”, “Dark olive”, “003300”, “Dark green”, “003366”, “Dark azure”, “000080”, “Navy Blue”, “333399”, “Indigo”, “333333”, “Very dark gray”, “800000”, “Maroon”, “FF6600”, “Orange”, “808000”, “Olive”, “008000”, “Green”, “008080”, “Teal”, “0000FF”, “Blue”, “666699”, “Grayish blue”, … Read more