How to add a new font in WordPress?



If you are looking for the algorithm of new font adding to a WordPress website then welcome to my post!
I encountered some problems during the adding a new font to my  WordPress website.
My solution took one work day for me and included mistakes with its solutions. Here I'm going to share with you my algorithm!

After researching this problem I concluded:
1) the solutions of this problem were very similar on all websites I found (moreover, there was something missed as I saw later);
2) I decided that right way for me is using CSS for adding new font to my WordPress site.

Guide for adding a new font to a WordPress site.
1. Choose a font (you can use this service).
2. Download it in otf/ttf format.
3. For the browsers, download all needed formats: ttf,woff, woff2, oet, svg (this one could be helpful).
4. Unpack the archive and save these formats into fonts folder of your website.
5. Create the css file of a new font using @font-face (you can use this one from archive) and save it in css folder.
6. Register new css file in the website theme. I did it in functions.php file by adding a liitle more code in function connect_theme_stylesheets(),
Trouble.
1. It doesn't work (there're no changes on the website).
a) if you use browser cashing, then clean it;
b) the browser can't download the css/font files because you registered it in wrong way.

If you have any questions, you can ask me in the comment box. 

Комментарии

Популярные сообщения из этого блога

A UML use case with PowerDesigner (in Russian) | Как создать UML use case в PowerDesigner

A UML use case with PowerDesigner

How to add a new font in WordPress? (in Russian) | Как добавить шрифт на сайт WordPress?