get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; $wp_customize->add_setting( 'accent_color', array( 'default' => '#076DA3', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'accent_color', array( 'label' => __( 'Accent Color', 'bloatless' ), 'section' => 'colors', ) ) ); $wp_customize->add_setting( 'accent_color_dark', array( 'default' => '#043c5a', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'accent_color_dark', array( 'label' => __( 'Darker Accent Color', 'bloatless' ), 'section' => 'colors', ) ) ); $wp_customize->add_setting( 'general_color', array( 'default' => '#333333', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'general_color', array( 'label' => __( 'Main Color', 'bloatless' ), 'section' => 'colors', ) ) ); $wp_customize->add_setting( 'grey', array( 'default' => '#5E5E5E', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'grey', array( 'label' => __( 'Secondary Color', 'bloatless' ), 'section' => 'colors', ) ) ); $wp_customize->add_setting( 'light_gray', array( 'default' => '#efefef', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'light_gray', array( 'label' => __( 'Light Secondary Color', 'bloatless' ), 'section' => 'colors', ) ) ); $wp_customize->add_setting( 'dark_gray', array( 'default' => '#666666', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'dark_gray', array( 'label' => __( 'Dark Secondary Color', 'bloatless' ), 'section' => 'colors', ) ) ); } add_action( 'customize_register', 'bloatless_customize_register' ); /** * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. */ function bloatless_customize_preview_js() { wp_enqueue_script( 'bloatless_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20151215', true ); } add_action( 'customize_preview_init', 'bloatless_customize_preview_js' ); function bloatless_wp_head_css() { $dark_gray = get_theme_mod( 'dark_gray', '#666666' ); $grey = get_theme_mod( 'grey', '#5E5E5E' ); $light_gray = get_theme_mod( 'light_gray', '#efefef' ); $general_color = get_theme_mod( 'general_color', '#333333' ); $accent_color = get_theme_mod( 'accent_color', '#076DA3' ); $accent_color_dark = get_theme_mod( 'accent_color_dark', '#043c5a' ); $bg_color = get_background_color(); $bg_color = str_replace( '#', '', $bg_color ); $bg_color = '#' . $bg_color; ?>