wp_add_inline_style doesn't work
-
Hello,
I pasted following code in functions.php file:
function my_styles_method() { wp_enqueue_style( 'custom-style', get_template_directory_uri() . '/css/custom_script.css' ); $color = #FF0000; //E.g. #FF0000 $custom_css = " .mycolor{ background: {$color}; }"; wp_add_inline_style( 'custom-style', $custom_css ); } add_action( 'wp_enqueue_scripts', 'my_styles_method' );custom_script.css file is displayed in source of website but file is just empty, chmod of file is 644
https://codex.ww.wp.xz.cn/Function_Reference/wp_add_inline_style
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘wp_add_inline_style doesn't work’ is closed to new replies.