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 WordPress Experts at Codeable.

The only WordPress exclusive freelancer platform that connects thousands of customers with the top WordPress freelance experts to work on projects of any size. 

Free estimate • No obligation to hire • 100% risk-free