当我尝试添加十六进制颜色时,它会在前端划掉,如果我直接添加颜色,即黑色或白色,它会起作用。。如何解决此问题。
This one does not work
function my_styles_method() {
wp_enqueue_style(
\'custom-style\',
get_template_directory_uri() . \'/css/custom_script.css\'
);
$color = #FF0000 ;
$custom_css = "
.mycolor{
background: {$color};
}";
wp_add_inline_style( \'custom-style\', $custom_css );
}添加操作(\'wp\\u enqueue\\u scripts\',\'my\\u styles\\u method\');?>
But this one works
function my_styles_method() {
wp_enqueue_style(
\'custom-style\',
get_template_directory_uri() . \'/css/custom_script.css\'
);
$color = black;
$custom_css = "
.mycolor{
background: {$color};
}";
wp_add_inline_style( \'custom-style\', $custom_css );
}添加操作(\'wp\\u enqueue\\u scripts\',\'my\\u styles\\u method\');?>