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.
Leave a Reply
You must be logged in to post a comment.
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’sstyle.css
file pointing to the new font:You can then reference that custom font in other CSS styles, for example:
I think its best to upload your font file to a web font generator.
After downloading the font kit, you can upload the unzipped folder to your themes root directory and rename it to fonts.
Then you can use the @font-face CSS from the style sheet in the kit to link to your font files in your parent or child themes style.css file.
After this, it is simply a matter of using the new font-family name in your CSS rules in your style.css file.
Adding Google fonts is different and can be done using a variety of methods, PHP being the most efficient and flexible via your functions.php file:
Since nowadays you can find the best fonts on Google-fonts
(..and there’s no better CDN than the google network),
I think the best solution is to import it from them.
The best for doing this is adding a function that hooks to wp_head hook,
to functions.php add
The alternative is to try with Use Any Font plugin. Note that you can add only one custom font for free. For detailed instructions, please follow video tutorial that we found here http://dnesscarkey.com/virtual-support/use-any-font.php