Using Wordpress? Get our lightening fast Wordpress Optimised Hosting.
Get Wordpress Hostingfunction myprefix_enqueue_google_fonts() {
wp_enqueue_style( 'roboto', 'https://fonts.googleapis.com/css?family=Roboto' );
}
add_action( 'wp_enqueue_scripts', 'myprefix_enqueue_google_fonts' );
In this particular snippet, we used the wp_enqueue_style function to load the “Roboto” Google font on the website. However, you can use this function multiple times to load multiple fonts. Now you just have to open your style.css file and change the font name for the elements you want the custom font for or add some Custom CSS to your site to alter the font, such as the following example to change the whole body font to Roboto.body { font-family: "Roboto"; }
And that's all there is to manually loading Google Fonts to your website! With these methods you'll be able to utilise all 800+ fonts available to you, meaning you can customize and personalise your site right down to the tiniest detail.
Some final tips are:Using Wordpress? Get our lightening fast Wordpress Optimised Hosting.
Get Wordpress Hosting
Related Posts
Comments
Comments are closed here.