由于某种原因,我无法输出颜色。一切正常,但text_color
只是不想输出它的值。
出了什么问题?
后端代码(functions.php):
$wp_customize->add_setting(\'text_color\', array(
\'default\' => \'#fff\',
\'sanitize_callback\' => \'sanitize_hex_color\',
\'type\' => \'option\',
));
$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, \'text_color\', array(
\'label\' => __(\'Text color\', \'pc\'),
\'section\' => \'colors\',
\'settings\' => \'text_color\',
)));
前端代码:
if(!empty(get_theme_mod( \'text_color\' ))) {
?>
h1, h2, h3, h4, h5, h6 {
color:<?php echo get_theme_mod( \'text_color\' ); ?>
}
<?php
}