• Resolved Webreaper

    (@webreaper)


    I’m using the Zoom Lite theme but want to use some other fonts – in particular Bitter – for the site title and so on.

    I’ve created a child theme, enqueued the fonts in my functions.php using:

    
    wp_enqueue_style('pumpkin-google-fonts', 'https://fonts.googleapis.com/css?family=Bitter|Georgia|Source%20Sans%20Pro', false);
    

    (and then add_action).

    I then specify in my site title and header CSS {in style.css) to use that family, for example:

    
    h1, h2, h3, h4, h5, h6 {
      font-family: "Bitter";
    }
    

    But nothing works, and the site still doesn’t use the font. I’ve tried adding !important to the style attribute and a load of other things, but nothing works. I even installed TK Google Fonts plugin to see if that would solve it. But no joy. I’ve cleared the cache, server and client side, to no effect.

    The weird thing is that a couple of times the font did show correctly. It worked for an hour or so, then reverted. But most of the time, it’s wrong.

    Any ideas what’s going on, and how to fix? I’m wondering if there’s some sort of race condition and the font is loading too late to render the text, but that seems unlikely. I’m not sure how to proceed…

    • This topic was modified 7 years, 8 months ago by Jose Castaneda. Reason: added backticks for code

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Your font link looks like one of mine except that yours has a version parameter that mine does not.
    When I use the View Source option in the browser, I can click on the link to the font.
    Clicking on yours shows a 403 error page from Google.
    Clicking on mine shows CSS for the font.

    I don’t know what’s wrong, but the only difference is the version number, so I would try removing that.

    Thread Starter Webreaper

    (@webreaper)

    Thanks for replying. I think the version number is just used for cache-busting, so shouldn’t be the problem. Not sure though.

    However, I tried installing the Self Hosted Google Fonts plugin, which pulls the fonts into the local site and updates the CSS, and that seems to have done the trick – I now see Bitter as the site title and header fonts on 3 computers I’ve tried, and on my smartphone!

    So you could be right, perhaps it wasn’t pulling the fonts from Google reliably.

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    cache-busting

    Yes, the version parameter is used for cache – typically-, though from taking a look at that it looks like you are setting the dependencies to false. Would have no effect, I don’t think.

    What I’m wondering is what your code looks like. The add_action part at least.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Google Fonts not always working’ is closed to new replies.