enqueue multiple Google fonts with multiple weights and styles (italic)


I am trying to enqueue multiple Google fonts with multiple weights (400,600,700, etc,) and styles (normal, italic) and can’t figure out why it is not working.

This is the code that I am using in the functions.php:

function load_fonts() {
wp_register_style('googleFonts', 'http://fonts.googleapis.com/css?family=Dosis:400,600,700|Roboto:400,400italic,700,700italic');
wp_enqueue_style( 'googleFonts');
add_action('wp_print_styles', 'load_fonts');

This is the link that is being output in the source:

<link rel='stylesheet' id='googleFonts-css'  href='http://fonts.googleapis.com/css?family=+Dosis%3A400%2C600%2C700%7CRoboto%3A400%2C400italic%2C700%2C700italic&ver=4.4.2' type='text/css' media='all' />

I tested IOS devices at BrowsserStack and using the WhatFont browser extension and the WhatFont extension for Safari on an iPhone (worked well). It showed it using the fallback font-family Arial. I realized that this has something to do with the server (cheap shared hosted plan — ugh!). What I am not quite sure, but I appreciate everyone’s input

Any idea’s?

, elarson 3 years 2020-08-22T18:10:56-05:00 0 Answers 50 views 0

Leave an answer