Add Google Fonts To WordPress Child Theme

When adding a Google font to your WordPress website, use the enqueue function.

When adding a Google font to your WordPress website, using the enqueue function allows you to load multiple font weights without making a separate call for each one. This is more efficient than using @import in CSS.

function em_add_google_fonts() {
	if (!is_admin()) {
		wp_register_style('google', 'https://fonts.googleapis.com/css?family=Roboto:300,400,700', array(), null, 'all');
		wp_enqueue_style('google');
	}
}
add_action('wp_enqueue_scripts', 'em_add_google_fonts');

Hire a WordPress Expert

Get hourly and project based theme customization, theme tweaks, and development help from an experienced Kelowna WordPress developer.  We’ve been building WordPress websites full-time for over a decade. We can help you.