Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #210948

    Hi,
    I tried to add new Google fonts: PT Sans Narrow and PT Sans. A both with cyrilic.
    I used instruction from this topic. I added both parts of the code from this topic.
    After adding the first part, I did not see the new font in the font selection in Styling.
    After the second part of the code instead of admin panel opens a blank white page.
    I use a network of sites. Maybe is it make a problem?

    #211016

    Hi Kvanto!

    Please locate this code on functions.php, you can find it at the very top:

    global $avia_config;

    Below, add the google font filter:

    add_filter( 'avf_google_heading_font',  'avia_add_heading_font');
    function avia_add_heading_font($fonts)
    {
    $fonts['PT Sans Narrow'] = 'PT Sans Narrow';
    $fonts['PT Sans'] = 'PT Sans';
    return $fonts;
    }
    
    add_filter( 'avf_google_content_font',  'avia_add_content_font');
    function avia_add_content_font($fonts)
    {
    $fonts['PT Sans Narrow'] = 'PT Sans Narrow';
    $fonts['PT Sans'] = 'PT Sans';
    return $fonts;
    }

    Cheers!
    Ismael

    #211163

    Nope. Blank white page is again.
    But all is work after removing any new codes.((

    • This reply was modified 3 years, 10 months ago by  Kvanto.
    #211526

    Hey!

    I just tested this one out the other day as I was writing it up for the documentation. This is exactly what I have on my live site right now and its working:

    
    <?php
    
    global $avia_config;
    
    add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
    function avia_add_heading_font($fonts)
    {
    $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700';
    $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic';
    return $fonts;
    }
    
    add_filter( 'avf_google_content_font', 'avia_add_content_font');
    function avia_add_content_font($fonts)
    {
    
    $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic';
    $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700';
    return $fonts;
    }
    
    

    The new fonts will show up at the bottom of the list. If you are getting a blank screen it means the code hasn’t been added in correctly. Even a single missing } will cause WordPress to be unable to read the file so make sure that you are editing the file in a clean text editor that doesn’t add any other markup (like notepad) and that its exactly the same as above.

    Best regards,
    Devin

    #211707

    I added the code how you tell – http://take.ms/lzhY2
    Site is work. But fonts not change in preview, when I choose my custom fonts in selects – http://take.ms/tuimr
    After save this changes on site loading Open Sane font – http://take.ms/VLEBs

    Thank for your support! I hope we will solve this problem))

    • This reply was modified 3 years, 10 months ago by  Kvanto.
    #211730

    Hi!

    Your code is incorrect. Remove the + sign:

    add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
    function avia_add_heading_font($fonts)
    {
    $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700';
    $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic';
    return $fonts;
    }
    
    add_filter( 'avf_google_content_font', 'avia_add_content_font');
    function avia_add_content_font($fonts)
    {
    
    $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic';
    $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700';
    return $fonts;
    }

    Best regards,
    Ismael

    #211737

    http://take.ms/OwSd8
    Nothing not change. Open Sans loading again.

    And I need a cyrillic fonts.

    • This reply was modified 3 years, 10 months ago by  Kvanto.
    #211760

    Have you selected the new font in your theme options under the styling tab? If so, can we see the site live so we can inspect the font stack and see what it isn’t getting loaded in?

    #211769
    #211786

    Hi!

    This is the font now:

    h1, h2, h3, h4, h5, h6, tr.pricing-row td, #top .portfolio-title, .callout .content-area, .avia-big-box .avia-innerbox, .av-special-font {
    font-family: 'PT Sans Narrow', 'HelveticaNeue', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    }

    It means that the font works. Please remove browser cache then reload the page. The font is being called on the properly:

    <link id=”google_webfont_1″ rel=”stylesheet” type=”text/css” href=”http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700″>
    <link id=”google_webfont_2″ rel=”stylesheet” type=”text/css” href=”http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic”>

    Best regards,
    Ismael

    #211815

    Ok, thank you. Now it is ok. But it work only for latin characters.
    This fonts support cyrillic characters. How can I add this correctly?

    #212124

    Hey!

    You can select the subset with &subset=XXX – i.e.:

    
    add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
    function avia_add_heading_font($fonts)
    {
    $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700&subset=cyrillic';
    $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic&subset=cyrillic';
    return $fonts;
    }
    
    add_filter( 'avf_google_content_font', 'avia_add_content_font');
    function avia_add_content_font($fonts)
    {
    
    $fonts['PT Sans'] = 'PT Sans:400,700,400italic,700italic&subset=cyrillic';
    $fonts['PT Sans Narrow'] = 'PT Sans Narrow:400,700&subset=cyrillic';
    return $fonts;
    }
    

    Cheers!
    Peter

    #212299

    Thank you very much!

Viewing 13 posts - 1 through 13 (of 13 total)

The topic ‘Add a new custom font’ is closed to new replies.