So I installed WordPress locally and I'm on theme-development. I'm having a problem in linking my font files in my CSS. Is there any alternatives or best practices on how to link font files in a theme folder in WordPress?


If your theme's folder structure is similar to the following:

 |- index.php
 |- style.css
 |- fonts/font-name.ttf
 |- inc/some-file.php

then the code to connect the font files in your style.css will be:

@font-face {
  font-family: 'Font Name';
  src: url('fonts/font-name.ttf');

   font-family: 'Font Name', sans-serif;

There shouldn't be any problem!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.