• Dave Loebig

    (@pacesettermedia)


    In Theme.json > fontFace > src

    Are external sources like Google fonts supported?

    I can’t find documentation regarding external sources. The only examples I’ve found use a local source like “file:/assets/…”

    I’ve tried “file:” + the Google font link they provide, and even the font file at gstatic.com (https://fonts.gstatic.com/s/overlock/v15/Z9XSDmdMWRiN1_T9Z7xizfmLtrw.woff2)

    I’ve tried “url” + Google font link or direct file link

    I’m developing on my local computer. There might be a security feature blocking external links like this. So that might be a confounding factor.

    So my first question: are external sources even supported at all?

    Thanks.

    • This topic was modified 2 years, 10 months ago by Dave Loebig.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    You could output the needed head section style tag referencing the font source from the “wp_print_styles” action hook. The PHP code to do this can reside in functions.php. Then you can specify the fonts so loaded in the font-family style rule in theme.json.

    Hi @bcworkz, could you be more specific? It’s been a long time since I did WP dev and I’m trying to do the same thing. But I don’t understand your post and the steps needed to do this.

    Thanks.

    • This reply was modified 2 years, 8 months ago by chrleon. Reason: Forgot a question mark
    Thread Starter Dave Loebig

    (@pacesettermedia)

    Thanks @bcworkz, I’ll read up on “wp_print_styles”

    @chrleon , I don’t have a specific answer, but try looking up  “wp_print_styles” and theme function.php. You’ll find at least some explanation and tutorials on the hook and adding functions to functions.php.

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

The topic ‘Theme.json FontFace src Using External Source Like Google’ is closed to new replies.