Want to remove Google font Lato in your Twenty Fourteen WordPress theme? Is Lato font slowing down your site? Have you noticed how no text content is visible on your site on slow speed internet connections till the Lato font is loaded. We use the amazing 2014 theme and here is the way to do it.

Advertisements

Slow Loading 7 Lato Font Variants!

If you see the functions.php file of the Twenty Fourteen theme, you will notice that by default it loads 7 Lato font variants!!

function twentyfourteen_font_url() {
	$font_url = '';
	if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) ) {
		$font_url = add_query_arg( 'family', urlencode( 'Lato:300,400,700,900,300italic,400italic,700italic' ), "//fonts.googleapis.com/css" );
	}

	return $font_url;
}

As is the Lato font has a larger impact on page loading time, and adding 7 variants will have a huge 350 impact if you check the load time impact.

lato font load time

No wonder your site goes blank on text as the html loads quickly but the Lato font takes time to load. I recommend you read our tips on how to load Google Fonts faster.

Reduce Google Lato Font Variants

If you love the Lato font, an easier way would be to remove some font variants. This will have some design impact but you can reduce the variants. You need to edit the code in functions.php and reduce the font variants

Instead of loading
Lato:300,400,700,900,300italic,400italic,700italic

Try loading only the normal and bold variants.
Lato:400,700

Although this works, some text fonts in places like italics or blockquotes look awkward.

Remove Google Lato Font

You can remove the Lato font totally, and choose some other style like web safe Arial font which will load instantly. This is what we have done.

Add this code to your child theme at the bottom of the functions.php file. [Note that functions.php is a very powerful file and wrong changes can bring your site down. Always keep a backup via ftp if needed.)

// Remove Lato Font
function qot_dequeue_fonts() {
wp_dequeue_style( 'twentyfourteen-lato' );
}
add_action( 'wp_enqueue_scripts', 'qot_dequeue_fonts', 11 );

If you are still using the primary theme, then simply comment out the code. You should always use the child theme to get easier theme updates without ruining custom changes.

Do this and note how fast your site loads with the Twenty Fourteen theme. Try it.

13 Comments