Skip to content

Instantly share code, notes, and snippets.

@hashtheme
Created March 25, 2018 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hashtheme/7ead500f652507b0793820b6bd4a6d37 to your computer and use it in GitHub Desktop.
Save hashtheme/7ead500f652507b0793820b6bd4a6d37 to your computer and use it in GitHub Desktop.
Google font not show
<?php
function canon_hash_custom_css() {
$body_font = cs_get_option('body_font');
$body_font_size = cs_get_option('body_font_size');
$heading_font = cs_get_option('heading_font');
$heading_font_variants_array = cs_get_option('heading_font_variants');
$heading_font_variants = implode(',',$heading_font_variants_array);
$defferent_heading_font = cs_get_option('defferent_heading_font');
if (!empty($body_font)){
$body_font_family = $body_font['family'];
} else {
$body_font_family = 'Cousine';
}
if (!empty($heading_font)){
$heading_font_family = $heading_font['family'];
} else {
$heading_font_family = 'Cousine';
}
wp_enqueue_style(
'canon-hash-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).';font-weight: '.$body_font['variant'].'}
';
if ($defferent_heading_font == true) {
$custom_css .= 'h1,h2,h3,h4,h5,h6 {font-family: '.esc_html($heading_font_family).';font-weight: '.$heading_font['variant'].'}';
}
wp_add_inline_style( 'canon-hash-custom', $custom_css );
}
add_action( 'wp_enqueue_scripts', 'canon_hash_custom_css' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment