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 world-class WordPress developers at Codeable. If you’re in Kelowna and need a custom website for your business visit our Kelowna Web Design page now to get started.