Skip to content

Instantly share code, notes, and snippets.

@Galibri
Created February 22, 2018 14:13
Show Gist options
  • Save Galibri/c9ff31e09a8bb0cfcc5c6e07252d74e2 to your computer and use it in GitHub Desktop.
Save Galibri/c9ff31e09a8bb0cfcc5c6e07252d74e2 to your computer and use it in GitHub Desktop.
<?php
function industry_rrfonline_custom_css(){
$body_font = cs_get_option('body_font');
$diffrent_heading_font = cs_get_option('diffrent_heading_font');
$heading_font = cs_get_option('heading_font');
if(!empty($body_font)){
$body_font_family = $body_font['family'];
}else{
$body_font_family = 'Montserrat';
}
if($diffrent_heading_font == true && !empty($heading_font)){
$heading_font_family = $heading_font['family'];
}else{
$heading_font_family = 'Montserrat';
}
$body_font_size = cs_get_option('body_font_size');
wp_enqueue_style('industry-rrfonline-custom', get_template_directory_uri().'/assets/css/custom.css');
$custom_css = '';
$custom_css .= '
body{
font-family: '.esc_html($body_font_family).';
font-size: '.esc_attr($body_font_size).';
}
';
if($diffrent_heading_font == true && $body_font_family != $heading_font_family){
$custom_css .= '
h1,h2,h3,h4,h5,h6{
font-family: '.esc_html($heading_font_family).';
}
';
}
wp_add_inline_style( 'industry-rrfonline-custom', $custom_css );
}
add_action('wp_enqueue_scripts', 'industry_rrfonline_custom_css');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment