add_setting( 'header_textcolor' , array( 'default' => '007bff', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_setting( 'header_bg_color_setting', array( 'default' => '#343a40', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_bg_color', array( 'label' => __( 'Header Background Color', 'apelle-uno' ), 'section' => 'colors', 'settings' => 'header_bg_color_setting', ) ) ); /*color*/ $wp_customize->add_setting( 'header_color_setting_rgb', array( 'default' => '255,255,255', 'transport' => 'refresh', 'sanitize_callback' => 'awstheme_sanitize_rgba', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array( 'label' => __( 'Header Text Nav Color ', 'apelle-uno' ), 'section' => 'colors', 'settings' => 'header_color_setting_rgb', ) ) ); } function awstheme_sanitize_rgba( $color ) { if ( empty( $color ) || is_array( $color ) ) return 'rgba(0,0,0,0)'; if ( false === strpos( $color, 'rgba' ) ) { list($r, $g, $b) = sscanf($color, "#%02x%02x%02x"); return $r.','.$g.','.$b; } $color = str_replace( ' ', '', $color ); sscanf( $color, 'rgba(%d,%d,%d,%f)', $red, $green, $blue, $alpha ); return $red.','.$green.','.$blue;} add_action( 'customize_register', 'apelleuno_customize_register' ); add_action( 'wp_head', 'apelleuno_customizer_css'); function apelleuno_customizer_css() { $header_textcolor = get_theme_mod('header_textcolor', '007bff'); $header_color_setting_rgba = get_theme_mod('header_color_setting_rgb', '255,255,255'); ?>