Add this snippet to the “themenamehere_load_scripts()” function in your theme’s functions.php
wp_enqueue_script( 'google-webfonts', 'https://ajax.googleapis.com/ajax/libs/webfont/1.5.18/webfont.js', array( 'jquery' ), '1.5.18' );
wp_enqueue_script( 'custom-gfonts', get_bloginfo( 'stylesheet_directory' ) . '/js/fonts.js', array( 'jquery' ), '1.0.0' );
Create a file in your themes js folder named fonts.js
. Paste in the code below. Of course change the fonts as needed here.
WebFont.load({
google: {
families: ['Lato:300,400,700,300italic,400italic,700italic', 'Libre Baskerville:400,700,400italic']
}
});