Skip to content

Instantly share code, notes, and snippets.

@wpspeak
Last active April 16, 2019 14:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpspeak/6068342 to your computer and use it in GitHub Desktop.
Save wpspeak/6068342 to your computer and use it in GitHub Desktop.
Use Google Custom Fonts in WordPress
<?php
// Use Google Custom Fonts in WordPress
function load_custom_fonts() {
wp_register_style('googleFonts', 'http://fonts.googleapis.com/css?family=Rock+Salt|Neucha');
wp_enqueue_style( 'googleFonts');
}
add_action('wp_print_styles', 'load_custom_fonts');
Using 'Neucha' custom font
// Before
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: Helvetica, Arial, sans-serif;
line-height: 1.25;
margin: 0 0 10px;
}
// After - 'Neucha' font added
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Neucha', Helvetica, Arial, sans-serif;
line-height: 1.25;
margin: 0 0 10px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment