I'm trying to get output from below setting but it is now working and displaying blank. When I try to echo
in plan text then some times it appear in customizer mode. i'm using <?php echo get_theme_mod( 'shoplabel_color' ); ?>
to Get output. Is there anything which i'm missing like javascript or any?
$wp_customize->add_setting('label_color',
array(
'default' => '43AC6A',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'theme_slug_sanitize_hex_color'
));
$wp_customize->add_control(
new WP_Customize_Color_Control($wp_customize, 'label_color',
array (
'settings' => 'label_color',
'section' => 'my_theme_page',
'label' => __( 'Label color', 'theme_slug' )
) ));
Ok resolve the issue problem in default function which i copied from chip code so now I write new function, It's working
function theme_slug_sanitize_hex_color( $color ) {
if ( '' === $color )
return '';
// 3 or 6 hex digits, or the empty string.
if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) )
return $color;
return null;
}