Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #315391

    Not the best title in the world, but the best I can describe what I’m talking about in 1 line.

    I wanted to add the Google Font Titillium Web (https://www.google.com/fonts/specimen/Titillium+Web) to my website so followed the instructions on https://kriesi.at/support/topic/using-custom-google-font/

    Here’s my problem. When editing the functions.php file, the instructions want you to add this (using Monda as an example):

    $fonts[‘Monda’] = ‘Monda’;

    If you want to add Titillium+Web, you would add this:

    $fonts[‘Titillium+Web’] = ‘Titillium+Web’;

    But when Enfold renders the page, it creates css with the font family ‘Titillium+Web’ however the actual font family is ‘Titillium Web’, ie, no +

    I assume the code is picking up the name of the font family from the functions.php file, but you can’t change that to remove the + otherwise the font isn’t picked up in the first place.

    I’m stuck between a rock and a hard place and for now I have just used the custom CSS to force the font family to ‘Titillium+Web’ where I need it, but I think that is messy.

    Any ideas?

    #315484

    Hey!

    Use this code:

    add_filter( 'avf_google_content_font', 'avia_add_content_font');
    add_filter( 'avf_google_heading_font', 'avia_add_content_font');
    function avia_add_content_font($fonts)
    {
    	$fonts['Titillium Web'] = 'Titillium+Web';
    	return $fonts;
    }

    And add this to Quick CSS:

    body {
        font-family: 'Titillium Web';
    }

    Cheers!
    Josue

    #315715

    That’s essentially what I have done as a hack already, but it gets messy as I have to double check all uses of the font and then force the font family with the QuickCSS against all types I want to use it on (Body, H1, H2…..).

    (By the way, the CSS above only works if you put !important on it.

    Doesn’t this really come down to a bug in the code where (or at least a shortcoming for “two word” font titles?

    #316233

    Hey!

    Did you try adding it without the +? The theme actually already adds lots of fonts with spaces in them so it should slide in with the rest of them. You can see them all in includes / admin / register-backend-google-fonts.php.

    Best regards,
    Devin

    #316676

    Well, I was about to say “yes I have and it doesn’t work”. I tried that yesterday and it didn’t work.

    But I gave it another go based on the code above rather than the one in the other thread (not that there is much difference) and it does work. Well, it looks like it does and I don’t think I have any caching going on that would make it look like it would work based on the earlier hack I did.

    So, thank you. It looks like we have a winner!

    #316682

    Great! Glad that worked for you :)

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Bug: Use of custom Google fonts with a + in the name’ is closed to new replies.