Wordpress: Add A Google Font into the Header


/ Published in: PHP
Save to your folder(s)

You might also consider just installing this Wordpress plug-in. It's way easier https://wordpress.org/plugins/google-typography/


Copy this code and paste it in your HTML
  1. /** ******** ******** ******** ******** ******** ******** ******** ********
  2. * TITLE: Add Google Font
  3. * DESCRIPTION: Add a Google Font into the header. You might want to look into installing this plug-in instead [Google Typography](https://wordpress.org/plugins/google-typography/). It's way easier to use.
  4. *
  5. *
  6. */
  7.  
  8. function add_fonts() {
  9. // Styles Format: wp_enqueue_style($handle, $src, $deps, $ver, $media);
  10. wp_register_style('open-sans', 'http://fonts.googleapis.com/css?family=Bree+Serif:400,300,700', array(), false, 'all');
  11. wp_enqueue_style( 'open-sans');
  12. }
  13. add_action('wp_enqueue_scripts', 'add_fonts', 100);

URL: https://wordpress.org/plugins/google-typography/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.