Support » Themes and Templates » [Theme: Scrappy] google fonts

  • Why can’t I find the link to the Google web fonts that are used in Scrappy (Rochester, for one)?

    I’m expecting to find this:

    <link rel="stylesheet" type="text/css" href="">

    somewhere in header.php inside the <head> element. Is that not what I should be looking for?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Themes in the repository (at least, new themes) are required to enqueue any additional stylesheets in functions.php, so you’ll find the links to Google fonts there!

    Ah, thanks, sixhours. I see it. Looks like this in functions.php:

    function scrappy_print_styles() {
    	wp_register_style('googleFonts', '|Unna|Alegreya:400italic,700italic,400,700');
    	wp_enqueue_style( 'googleFonts');
    add_action( 'wp_enqueue_scripts', 'scrappy_print_styles' );

    But now I’m curious why (it does seem to work fine in header.php, too) But is putting it in functions.php this way considered a best practice? If so, do you know the reason this is preferable?

    There are a few good reasons I can see off the top of my head… registering and enqueueing the styles keeps them available to other WordPress functions should an admin require more advanced interactions with them. It allows the admin to prioritize and set dependencies for the styles as they load, or only load styles in certain cases (admin panel vs. front end, for instance). It also keeps header.php clean and easy to read at a glance.

    It’s possible there are other good reasons of which I’m unaware, but those are the reasons I use enqueued styles, personally.

    Thanks! I appreciate your time.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Theme: Scrappy] google fonts’ is closed to new replies.