How to add a custom font in a theme

I want to add a custom font into my theme. Please let me know if this is just as simple as uploading the font to a new folder named “fonts” and then changing the css and renaming the font-family property there or it’s somewhat different procedure. I am not sure about it. Please help me.

4 Answers
4

To use a custom font, simply upload the font to your theme folder and then add a CSS @font-face declaration to the top of your theme’s style.css file pointing to the new font:

@font-face {
font-family: CustomFont;
src: url('CustomFont.ttf');
}

You can then reference that custom font in other CSS styles, for example:

.entry-content { font-family: "CustomFont", sans-serif; }

Leave a Comment