Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #741926

    Hi

    I´m wondering if I can add “Source Sans Pro” to my child theme. I´ve added some code to the functions.php in the child-theme:

    add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
    function avia_add_heading_font($fonts)
    {
    $fonts['Source Sans Pro Extra Bold'] = 'Source Sans Pro:900&subset=latin,latin-ext';
    $fonts['Source Sans Pro Bold'] = 'Source Sans Pro:700&subset=latin,latin-ext';
    return $fonts;
    }
    
    add_filter( 'avf_google_content_font',  'avia_add_content_font');
    function avia_add_content_font($fonts)
    {
    $fonts['Source Sans Pro Light'] = 'Source Sans Pro:300&subset=latin,latin-ext';
    return $fonts;
    }

    Now, I have the option to select the Font in the “General Styling” Section. But on my mobile device (iphone 6s, Safari) or on another Computer (Safari, Firefox, Chrome) the text is displayed in the Helvetica Neue or Arial Font.

    When I´m going back to the Template Option Panel, General Styling, then the dropdown is on the default value.

    My WordPress is running on V. 4.7.2, the Theme is V. 3.8.4.

    Thanks in advance.

    #742466

    I looked in the Javascript Console in Chrome and there´s a error, corresponding to the Google Font:

    https://fonts.googleapis.com/css?family=Source+Sans+Pro:700&subset=latin-ext%7CSource+Sans+Pro:300&subset=latin-ext
    
    Failed to load resource: the server responded with a status of 400 ()

    The correct URL must be, I think it´s the “&amp” Code in the URL, which is not correct translated.

    https://fonts.googleapis.com/css?family=Source+Sans+Pro:700&subset=latin-ext

    Any Idea?

    #742653

    Hi,

    I’m not seeing that error message on my end and your site seems to be displaying the font you mentioned, did you manage to get it working?

    Best regards,
    Rikard

    #743050

    No, sorry. The Font is not shown in the frontend. Instead, there’s Helvetica displayed.

    #743172

    Hi,

    Not on my end, the only font being displayed is Source Sans Pro. Please try clearing your browser cache and reload a few times or try loading the site in an incognito window.

    Best regards,
    Rikard

    #743215

    Really? I already tried several Browsers in Incognito Mode and different clients like Osx, Windows, IOS.

    The Font is only displayed correctly if you are using Chrome and you’ve the font Source Sans Pro locally installed.

    #745293

    Hi!

    Did you disable the font? It’s not loaded in the frontend when I checked on Chrome and Firefox, Windows 7. Please post the login details here so that we can check the issue further.

    Best regards,
    Ismael

    #745488

    Hi,

    Yes, I disabled the Source Sans Pro. Now it´s SSP again. Here are the login credentials…

    Thanks!

    #745708

    Hi!

    Thank you for the update.

    We modified the code in the functions.php file. The correct font source is loading now.

    // https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700&subset=latin-ext

    Best regards,
    Ismael

    #746301

    Hi Ismael,

    Thanks for that. Unfortunatelly, I think it still doesn´t work. Even if I have the SourceSans Pro selected in the General Styling Section, it won´t show up in the front- or Backend, either in Chrome or in Safari and Firefox. Any idea?

    #747288

    Hey!

    Did you check the frontend? It might not be working in the preview but it’s applied in the actual site.

    Cheers!
    Ismael

    #747668

    Yes, sure… It´s not working in the frontend…

    #747844

    Hey!

    It’s not working because the stylesheets were minified. We disabled the minify settings temporarily and we had to add the following css code in the style.css file.

    body p, p {
        font-family: 'Source Sans Pro', 'HelveticaNeue', 'Helvetica Neue', Helvetica, Arial, sans-serif;
        font-weight: 300;
    }

    Please remove or purge all cache before checking the page.

    Cheers!
    Ismael

    #747907

    Ah, perfect. Thanks!

    Is it in general not possible to activate the stylesheet minify function?

    Thanks again and cheers!

    #748250

    Hey!

    Once the files are minified, changes or modifications might not reflect immediately in the frontend. You can activate it once you’re done working with the site.

    Cheers!
    Ismael

    #748266

    i often use the source sans pro – but only latin not latin extended – maybe this is causing the mismatch?

    and by the way you don’t need to mention the latin case because it is in the latin-extended version.
    so :

    add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
    function avia_add_heading_font($fonts)
    {
    $fonts['Source Sans Pro Extra Bold'] = 'Source Sans Pro:900&subset=latin,latin-ext';
    $fonts['Source Sans Pro Bold'] = 'Source Sans Pro:700&subset=latin-ext';
    return $fonts;
    }
    
    add_filter( 'avf_google_content_font',  'avia_add_content_font');
    function avia_add_content_font($fonts)
    {
    $fonts['Source Sans Pro Light'] = 'Source Sans Pro:300&subset=latin-ext';
    return $fonts;
    }
    #748272

    Hi!

    I’m not sure if the subset parameter can cause issues but the font url looks like this at the moment:

    // https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700&subset=latin-ext

    Regards,
    Ismael

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