I have a slightly tweaked child theme to twentysixteen (used solely on - feel free to view source!), and I would like to add a Google webfont. / suggests (as one option) to put e.g.
<link href="+One" rel="stylesheet">
before your theme imports its stylesheet. That sounds like sensible enough advice, but twentysixteen's header.php
does not contain strings I could find like "css". As a result, I don't know where the last line is in header.php
before the theme's stylesheet is loaded, or whether (in a child theme to twentysixteen) I should be editing some other file (and if so, which?).
I have provisionally placed <link href="+One" rel="stylesheet" />
in header.php
just after the open HEAD tag, but I suspect there are better or more surgical placements.
Where, in a twentysixteen child, should I place an HTML tag to import a Google font or the like?
Thanks,
I have a slightly tweaked child theme to twentysixteen (used solely on https://CJSHayward
- feel free to view source!), and I would like to add a Google webfont. http://www.wpbeginner/wp-themes/how-add-google-web-fonts-wordpress-themes/ suggests (as one option) to put e.g. <link href="https://fonts.googleapis/css?family=Sigmar+One" rel="stylesheet">
before your theme imports its stylesheet. That sounds like sensible enough advice, but twentysixteen's header.php
does not contain strings I could find like "css". As a result, I don't know where the last line is in header.php
before the theme's stylesheet is loaded, or whether (in a child theme to twentysixteen) I should be editing some other file (and if so, which?).
I have provisionally placed <link href="https://fonts.googleapis/css?family=Sigmar+One" rel="stylesheet" />
in header.php
just after the open HEAD tag, but I suspect there are better or more surgical placements.
Where, in a twentysixteen child, should I place an HTML tag to import a Google font or the like?
Thanks,
Share Improve this question edited May 11, 2019 at 0:06 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Sep 12, 2016 at 22:07 Christos HaywardChristos Hayward 639 bronze badges1 Answer
Reset to default 2You can place it in header.php
between starting <head>
and closing </head>
tags and it should work properly.
Or perhaps a better solution would be to enqueue the style in functions.php
function google_fonts() {
$query_args = array(
'family' => 'Sigmar+One'
);
wp_register_style( 'google_fonts', add_query_arg( $query_args, "//fonts.googleapis/css" ), array(), null );
}
add_action('wp_enqueue_scripts', 'google_fonts');