Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #502978

    Hello.
    Created new font. Let it name Open Sans Local
    1. Added to functions.php

    add_filter( 'avf_google_heading_font',  'avia_add_heading_font');
    function avia_add_heading_font($fonts)
    {
    $fonts['Open Sans (Local)'] = 'Open Sans Local:400,600';
    return $fonts;
    }
    
    add_filter( 'avf_google_content_font',  'avia_add_content_font');
    function avia_add_content_font($fonts)
    {
    $fonts['Open Sans (Local)'] = 'Open Sans Local:400,600';
    return $fonts;
    }

    2. Described this font in child theme style.css

    @font-face {
      font-family: 'Open Sans Local';
      font-style: normal;....... etc
    }

    Result: Theme tries to get this font from url
    https://fonts.googleapis.com/css?family=Open+Sans+Local:400,600%7COpen+Sans+Local:400,400

    and of course there will be GEt error. So how to force theme not to look at google? because this font is handled in style.css (i’ve made local copy of Open Sans)

    #503181

    Hi Alex!

    Thank you for using Enfold.

    1.) The filter is designated for google fonts only. You don’t need to use it in this case. Do the “Open Sans Local” font exists?

    2.) If you use the font face rule, you can automatically apply the font on different elements in the theme via Quick CSS or css > custom.css file. Example:

    body {
    font-family: 'Open Sans Local';
    }

    http://www.w3schools.com/cssref/css3_pr_font-face_rule.asp

    Best regards,
    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.