Как внедрить фонты в Wordpress

roboto fonts

Как внедрить фонты в Wordpress

Upload your font’s file to your theme’s folder

If you’re all about performance optimization, uploading font files to your website directly can enable you to shave a few milliseconds off your loading times. The first thing you’ll need, of course, is the font file you want to upload to your server:

Since WordPress doesn’t include a dedicated fonts folder, you’ll want to create one using your trusty FTP client. You can add the folder wherever you want, but we recommend placing it within your themes directory so you can keep track of it. Set it up now, and upload your font file to the new folder:

Once the file is in place, open up your child theme’s stylesheet. Now you’ll need to call on that font so you can use it, via a snippet that should look like this:

@font-face {
font-family: New Font;
src: url(http://www.yourwebsite.com/wp-content/themes//fonts/your-new-font.ttf);
font-weight: normal;

Please note the font family name and URL above are placeholders, which you’ll need to replace with the right information.

Once you’ve entered this code, don’t close your theme’s stylesheet just yet. You still need to configure which elements will use the new font, with some code that’s very similar to what we looked at in the last section:

.h1 site-title {
font-family: "New Font", Arial, sans-serif;

In this example, we’re configuring our H1 subheadings to use the new font. However you can replace that with any other element you want, or multiple elements if you’d like to use the font in more than one place.