retrieve "Link Color" value

I've set the Link color using the color picker in the front end. I want to use this color for buttons on the site so I used the following code in header.php

style
.btn{
    background-color: ?php echo get_theme_mod( 'link_color' ); ?;
}
/style

It worked and I could see the buttons change color to whatever I picked for Link Color setting. But it shows up only in Customization window. When I hit Publish and reload the site, I see the function is not returning any value.

style
.btn{
    background-color: ;
}
/style

This is what I see when I inspect element.

Also, I've used

.site,body{
    background-color: #?php echo get_theme_mod('background_color'); ?!important;
}

in header.php and it loads the color properly. I can used background_color , page_background_color, secondary_text_color with get_theme_mod and also get_option functions but not link_color or main_text_color.

How do I retrieve Link Color ?

Topic color-picker get-theme-mod php customization Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.