Add Google Font To WordPress Theme

To add Google font to your WordPress theme, you are not allowed to add it by <link> tag. The standard way is to add it by WordPress built-in functions. To do that, add below code to your functions.php file of your theme.

function hs_custom_add_google_fonts()
{
    wp_enqueue_style('custom-google-fonts', 'https://fonts.googleapis.com/css2?family=Lato&display=swap', false);
}
add_action('wp_enqueue_scripts', 'hs_custom_add_google_fonts');

Just change the url of the font add your favorite font.

Shopping Cart