0

I'm converting an html/css template to a WordPress theme. The index.html contains the following Google font which I want to include in the header.php : http://fonts.googleapis.com/css?family=Bree+Serif' rel='stylesheet'> Kindly advise how I can do this.

Regards

Debashis

0

1 Answer 1

2

As you probably know it's always a good idea to register and enqueue your styles within you functions.php.

As you can see in the Codex, there is a given order for the parameters of those functions. Simply put the data of the webfont in:

wp_register_style( $handle, $src, $deps, $ver, $media );
wp_enqueue_style( $handle, $src, $deps, $ver, $media );

So you'll probably have something like this in your functions.php:

function load_google_webfonts() {
    wp_register_style( 'bree', 'https://fonts.googleapis.com/css?family=Bree+Serif' );
        wp_enqueue_style('style', get_stylesheet_uri(), array('bree'), '1.0', 'all');
}
add_action( 'wp_enqueue_scripts', 'load_google_webfonts' );
3
  • Created the function in the function in the functions.php but this hasn't had any effect. Commented Oct 3, 2013 at 12:58
  • Ensure that you have included the wp_head() template tag in your Theme, usually in header.php, immediately before the closing HTML </head> tag. Commented Oct 3, 2013 at 13:01
  • You can use the font within your style.css like this: body { font-family: 'Bree Serif', serif; }
    – Sven
    Commented Oct 3, 2013 at 13:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.