Add custom css to theme

I have WP theme and I want to add dynamic styles. I use Kirki framework. So I add code to my function.php:

$btn_color = get_theme_mod( 'button_color');

function my_inline_css($btn_color) {
    if ( !empty($btn_color) ) {  ?>
        .btn { background-color:<?php echo esc_attr($btn_color);?>; } <?php
    }
}
add_action('wp_head','my_inline_css');

But it doesn’t work. How to solve this problem?

Read more here: Add custom css to theme

Leave a Reply

Your email address will not be published. Required fields are marked *