How to enqueue custom fonts in functions.php

Hello Guys!!!
I need help in enqueue custom fonts which is not a google font. In my HTML template, it looks like this

I have my custom fonts ready in my theme folder assets/fonts/circular.ttf

If anyone provides me a code to link in functions.php means it would be super helpful

Kindest Regards
Mohamed Ahshan

1 Like

Wordpress has enqueue hook functions. Before you start making themes, you should learn how to use these functions.

You can add your script files via the function here.

You can add css or font icons etc files with the function here.

And don’t forget to search for envato theme requirements other than wordpress basics
and wordpress category wants better quality products than html category
I suggest you watch a tutorial from wordpress premium theme creation resources and start this business for her.

β€˜β€™ Always starting from the right place will save you time. Be patient, the way to success is patience.’’.


If you add the font in functions.php using wp_enqueue_script() then it will be hard coded and will be dificult to change fonts for customer. So, you can add it into theme style.css using @font-face

@font-face {
   font-family: 'OpenSansRegular';
   src: url('css/fonts/OpenSans-Regular-webfont.eot');
   src: url('css/fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
        url('css/fonts/OpenSans-Regular-webfont.woff') format('woff'),
        url('css/fonts/OpenSans-Regular-webfont.ttf') format('truetype'),
        url('css/fonts/OpenSans-Regular-webfont.svg#OpenSansRegular') format('svg');
   font-weight: normal;
   font-style: normal;


but best to add/create a plugin for fonts setup, so that customer can change fonts from wp dashboard ( Appearance > Customize) or theme options settings.