Sign Up

Captcha Click on image to update the captcha.

Have an account? Sign In Now

Sign In

Discover the power of expert communities in searching for solutions.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question. Please subscribe to paid membership

Forgot Password?

Don't have account, Sign Up Here
Please subscribe to paid membership

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

GetSolu.com

GetSolu.com Logo GetSolu.com Logo

GetSolu.com Navigation

  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Home
  • About Us
  • Blog
  • Contact Us
Home/ Problems/Q 4043
Next
Need More Solution
Anonymous
  • 0
Anonymous
Asked: April 5, 20232023-04-05T07:47:36+00:00 2023-04-05T07:47:36+00:00In: Website Development

How to fix custom font not loading on WordPress site?

  • 0

I am trying to use a custom hosted font on my WordPress site, but it does not load properly. I have downloaded the font files (ttf, woff and woff2) and uploaded them to a folder called “fonts” in my theme directory. Then I added this code to my theme’s style.css file:

@font-face {
  font-family: "Courier Prime";
  font-weight: normal;
  font-style: normal;
  src: url("fonts/Courier_Prime/CourierPrime-Regular.ttf") format("truetype"),
       url("fonts/Courier_Prime/CourierPrime-Regular.woff") format("woff"),
       url("fonts/Courier_Prime/CourierPrime-Regular.woff2") format("woff2");
}

I also created a custom class called “courier” and applied it to the elements that I want to use the font:

.courier {
  font-family: "Courier Prime", monospace !important;
}

However, when I view the site, the font does not change and it still uses the default font. I have checked the browser console and there are no errors or warnings. I have also cleared the cache and tried different browsers, but nothing works.

What am I doing wrong? How can I make the custom font load correctly on my WordPress site? Any help or suggestions would be greatly appreciated.

wordpress
  • 1 1 Solution
  • 27 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    1 Solution

    • Voted
    • Oldest
    • Recent
    1. Mr. Zero
      2023-04-05T07:49:44+00:00Added an answer on April 5, 2023 at 7:49 am
      This answer was edited.

      One possible reason why your custom font is not loading properly on your WordPress site is that you are using a relative URL for the font files in your CSS code. This means that the browser will look for the font files in a different location depending on which page you are viewing. For example, if you are viewing a page with the URL https://example.com/blog/post-1/, then the browser will look for the font files in https://example.com/blog/fonts/Courier_Prime/, which does not exist.

      To fix this issue, you need to use an absolute URL for the font files, which starts with https:// and includes your domain name. For example, if your WordPress site is hosted at https://example.com/, then you need to change your CSS code to:

      @font-face {
      font-family: “Courier Prime”;
      font-weight: normal;
      font-style: normal;
      src: url(“https://example.com/fonts/Courier_Prime/CourierPrime-Regular.ttf”) format(“truetype”),
      url(“https://example.com/fonts/Courier_Prime/CourierPrime-Regular.woff”) format(“woff”),
      url(“https://example.com/fonts/Courier_Prime/CourierPrime-Regular.woff2”) format(“woff2”);
      }

      This way, the browser will always look for the font files in the correct location regardless of which page you are viewing.

      Another possible reason why your custom font is not loading properly on your WordPress site is that you are using a theme that does not support custom fonts or overrides them with its own fonts. To check if this is the case, you can try switching to a default WordPress theme like Twenty Twenty-One and see if your custom font works. If it does, then you need to either find a different theme that supports custom fonts or use a plugin like Google Fonts Typography or Elementor to add custom fonts to your WordPress site.

      These plugins allow you to easily upload and use custom fonts on your WordPress site without editing any code. They also provide options to choose different fonts for different elements of your site, such as headings, paragraphs, menus, buttons, etc.

      I hope this helps you solve your problem and make your custom font load correctly on your WordPress site. If you have any further questions or issues, please let me know.

      • 0
      • Share
        Share
        • Share onFacebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    Sidebar

    Add Your Problem

    Stats

    • Problems 31
    • Solutions 39
    • Best Solutions 5
    • Users 73
    • Popular
    • Solutions
    • Anonymous

      Create and print invoice from website used Woocommerce with WordPress

      • 2 Solutions
    • Anonymous

      Need show post by timeline on my blog website

      • 2 Solutions
    • Anonymous

      I want to find a software collage of photos with ...

      • 2 Solutions
    • Anonymous

      How to hide products that ware sold out in woocommerce?

      • 2 Solutions
    • Anonymous

      SMTP Error: Could not authenticate. Zoho mail

      • 2 Solutions
    • Mr. Zero
      Mr. Zero added an answer The future may seem uncertain and project progress could potentially… April 20, 2023 at 3:23 pm
    • Mr. Zero
      Mr. Zero added an answer One possible solution to your problem is to use the… April 5, 2023 at 8:06 am
    • Mr. Zero
      Mr. Zero added an answer One possible way to get the page URL by the… April 5, 2023 at 7:58 am
    • Mr. Zero
      Mr. Zero added an answer One possible reason why your custom font is not loading… April 5, 2023 at 7:49 am
    • Mr. Zero
      Mr. Zero added an answer The problem with your current query is that you are… April 5, 2023 at 7:42 am

    Top Members

    Pemberton Lockwood

    Pemberton Lockwood

    • 0 Problems
    • 4 Solutions
    Master
    Idris Rhiannon

    Idris Rhiannon

    • 0 Problems
    • 3 Solutions
    Master
    Kevin Hernandez

    Kevin Hernandez

    • 0 Problems
    • 2 Solutions
    Master

    Trending Tags

    affiliate marketing ai career development freelance job income generation paywall profitable website startup woocommerce wordpress

    Explore

    • Home
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges

    Footer

    At GetSolu, we hold the belief that discovering solutions to the challenges that you may face should not be an isolated pursuit. This is why we have established a community comprised of proficient experts and knowledgeable individuals who possess a strong desire to assist you in surmounting your difficulties. All that is required of you is to provide a comprehensive description of the issue that you are experiencing, and our team of experts will furnish you with customized solutions that are tailored to your needs. Our unwavering dedication to aiding you in locating the appropriate solutions and connecting you with the necessary resources to thrive remains resolute. There is no need to hesitate. Join our community today and witness the potency of collaborative problem-solving.

    • Terms of Service
    • Privacy Policy

    Follow

    © 2023 Get Solu. All Rights Reserved
    With Love by Mr. Zero.