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


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: