We know that in WordPress themes we often provide theme options where a layman who doesn't know the coding can also make changes in font style, color etc.
so when we generate user generated CSS in a php file how does it get implemented in the live website.
Code in css-functions.php →
function selected_typography() {
$output='';
$h1typography = of_get_option('h1typography');
$h2typography = of_get_option('h2typography');
$h3typography = of_get_option('h3typography');
$h4typography = of_get_option('h4typography');
$h5typography = of_get_option('h5typography');
$h6typography = of_get_option('h6typography');
if ($h1typography) {
$output.='h1{
font-family:'.tmarketo_charito_load_google_font_styles($h1typography['face']).';
font-size:'.$h1typography['size'].';
font-weight:'.$h1typography['style'].';
color:'.$h1typography['color'].';
}
h1 a{
font-family:'.tmarketo_charito_load_google_font_styles($h1typography['face']).';
font-size:'.$h1typography['size'].';
font-weight:'.$h1typography['style'].';
}';
}
if ($h2typography) {
$output.='h2{
font-family:'.tmarketo_charito_load_google_font_styles($h2typography['face']).';
font-size:'.$h2typography['size'].';
font-weight:'.$h2typography['style'].';
color:'.$h2typography['color'].';
}';
}
return $output;
}
But the above CSS is not getting implemented on the live website. that means h2 and h1 don't show any change. Any suggestions or a Fix?
Additional information →
I purchased a premium theme → they are also doing it like this → https://www.screencast.com/t/GBvrEvqG98 and it works like a charm in their theme.
<style>block? It's not clear from the code.<style>block round it.