2

I have a slightly tweaked child theme to twentysixteen (used solely on https://CJSHayward.com - feel free to view source!), and I would like to add a Google webfont. http://www.wpbeginner.com/wp-themes/how-add-google-web-fonts-wordpress-themes/ suggests (as one option) to put e.g. <link href="https://fonts.googleapis.com/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.com/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,

2

You 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.com/css" ), array(), null );
        }

add_action('wp_enqueue_scripts', 'google_fonts');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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