How to Add Custom Fonts in WordPress (3 EASY Ways)
By Naveed Ahmed | Reviewed by Syed Balkhi | April 26, 2024 | Reader Disclosure
Want to add custom fonts to your WordPress site? It’s a great way to enhance your site’s typography and user experience. Not only do custom fonts make your website look better, but they can also improve readability, create a brand image, and even increase the time users spend on your site.
In this comprehensive guide, I’ll walk you through three easy methods for adding custom fonts in WordPress: Google Fonts, Adobe Fonts (formerly Typekit), and the CSS3 @font-face method. I’ll also provide tips on how to load your fonts properly without slowing down your website.
As a WordPress expert with over 15 years of experience, I’ve seen firsthand how custom fonts can elevate a website’s design. Remember, using too many fonts can lead to a cluttered look and slower loading times. It’s best to choose two fonts and use them consistently throughout your design for a cohesive and visually appealing website.
Finding Custom Fonts for Your WordPress Site
The good news is that custom fonts are no longer expensive. Many resources offer fantastic free web fonts, including:
- Google Fonts: The largest and most popular free font library, offering a wide variety of styles.
- Adobe Fonts (formerly Typekit): Another great source for free and premium fonts, with a limited free plan available.
- FontSquirrel: A curated collection of free fonts, offering various styles and licenses.
- Fonts.com: A premium font service with a wide selection of high-quality fonts, including a free trial.
If you’re unsure how to combine fonts, try using a tool like Font Pair. This handy website helps designers find beautiful font pairings using Google Fonts.
When choosing fonts, remember that using too many different fonts can slow down your website. Stick to two fonts and use them consistently across your design to create a consistent and visually appealing look.
Method 1: Adding Custom Fonts from Google Fonts Using a WordPress Plugin
For beginners, using a plugin is the easiest and most recommended way to add and use Google Fonts on your WordPress site. Here’s how:
- Install and Activate the Google Fonts Typography Plugin: The first step is to install and activate the Google Fonts Typography plugin. You can find it in the WordPress Plugin Directory or search for it directly in your WordPress dashboard.
- Customize Your Fonts: After activating the plugin, you’ll see a new “Fonts Plugin” menu item in your WordPress dashboard. Click on it, and you’ll be taken to the WordPress Customizer, where you can customize your fonts.
- Choose Your Fonts: The plugin offers two main sections for font customization: “Basic Settings” and “Advanced Settings.” The “Basic Settings” section lets you choose default fonts for your site’s content, headings, buttons, and fields. The “Advanced Settings” section allows you to customize fonts for specific areas of your website, like the site title, navigation menu, content area, sidebar, and footer.
- Preview and Save: As you select new fonts, the plugin’s preview will automatically update, showing you how your fonts will look on your website. Once you’re happy with your font choices, click the “Publish” button to save your changes.
Remember, you can also use the plugin’s advanced settings to fine-tune your font selections. For example, you can adjust the font sizes, colors, and other styles for different elements on your website.
Method 2: Adding Google Fonts Manually in WordPress
If you’re comfortable with adding code to your WordPress theme files, you can also add Google Fonts manually. Here’s how:
- Select Your Fonts from Google Fonts: Visit the Google Fonts library and select the font you want to use. The font page will show you the styles available for that font. Select the styles you need for your project and click the “View selected families” button at the top.
- Copy the Embed Code: This will open a sidebar where you can copy the embed code. You can add this code to your WordPress site in two ways.
- Add the Code to Your Theme’s Header.php File: You can edit your theme’s header.php file and paste the code before the “ tag.
- Use a Plugin to Add the Code: If you’re not comfortable editing theme files, you can use a plugin like WPCode to add the code. Install and activate the WPCode plugin, then go to Code Snippets » Header & Footer and paste the embed code in the “Header” box. Click “Save Changes” to store your changes.
- Use the Font in Your Theme’s Stylesheet: After adding the embed code, you can use the font in your theme’s stylesheet. For example, if you want to change the font of the site title, you would add the following CSS code to your theme’s stylesheet:
.h1 site-title { font-family: 'Open Sans', Arial, sans-serif; }
This code will apply the “Open Sans” font to the site title. You can also use the font for other elements on your website.
Method 3: Adding Custom Fonts in WordPress Using CSS3 @font-face
The most direct way to add custom fonts in WordPress is by using the CSS3 @font-face method. This method allows you to use any font you like on your website, even fonts that are not available from Google Fonts or Adobe Fonts.
- Download Your Font: First, download the font you want to use in a web format. If you don’t have the web format, you can use a tool like FontSquirrel’s Webfont generator to convert it.
- Upload the Font to Your WordPress Hosting Server: Once you have the web font files, upload them to your WordPress hosting server. The best place to upload them is inside a new “fonts” folder in your theme or child theme’s directory. You can use FTP or the File Manager in your cPanel to upload the font.
- Load the Font in Your Theme’s Stylesheet: After uploading the font, you need to load it in your theme’s stylesheet using the CSS3 @font-face rule. For example, if you uploaded a font called “Arvo” to the “fonts” folder in your theme’s directory, you would add the following CSS code to your theme’s stylesheet:
@font-face { font-family: Arvo; src: url(http://www.example.com/wp-content/themes/your-theme/fonts/Arvo-Regular.ttf); font-weight: normal; }
Make sure to replace the font family and URL with the actual font family name and the path to your font file on your server. After adding this code, you can use the “Arvo” font anywhere in your theme’s stylesheet. For example, you can use it for headings like this:
.h1 site-title { font-family: "Arvo", Arial, sans-serif; }
Loading Fonts Properly for Optimal Website Performance
Loading fonts directly using the CSS3 @font-face method might not always be the best solution. If you’re using a font from Google Fonts or Adobe Fonts, it’s best to serve the font directly from their servers for optimal performance. This is because Google Fonts and Adobe Fonts have optimized their servers to deliver fonts efficiently.
If you do decide to load your fonts locally, make sure to use a font format that is compatible with most web browsers. The most common font formats are WOFF2, WOFF, and TTF. Also, consider using a font optimization tool to reduce the file size of your font files. This will help to speed up your website’s loading time.
Conclusion
Adding custom fonts to your WordPress site is an excellent way to improve its typography and user experience. By choosing two fonts and using them consistently across your design, you can create a cohesive and visually appealing look for your site. Remember to consider loading times and optimize your fonts to ensure your website performs at its best.
FAQs
What are the best resources for finding free custom fonts?
The best resources for finding free custom fonts are Google Fonts, Adobe Fonts (formerly Typekit), and FontSquirrel.
How do I choose the right font for my website?
Consider your website’s design, target audience, and overall branding. Choose fonts that are readable, visually appealing, and complement your website’s overall style.
Can I add custom fonts to my WordPress.com website?
You can add custom fonts to your WordPress.com website, but you’ll need to use the Custom CSS feature. You can’t use plugins like Google Fonts Typography because WordPress.com has limited plugin functionality.
Will my font changes be lost if I update my theme?
If you add custom fonts to your theme’s stylesheet, your changes could be lost if you update your theme. To prevent this, create a child theme for your theme and add your custom fonts to the child theme’s stylesheet. This will ensure that your changes are not overwritten when you update your theme.
How do I use multiple font weights with the CSS3 @font-face method?
You can use the `font-weight` property in your CSS code to specify different font weights for your font. For example, if you have a font with regular and bold weights, you could add the following CSS code to your stylesheet:
@font-face { font-family: 'MyCustomFont'; src: url('path/to/font-regular.woff2') format('woff2'), url('path/to/font-regular.woff') format('woff'), url('path/to/font-regular.ttf') format('truetype'); font-weight: 400; } @font-face { font-family: 'MyCustomFont'; src: url('path/to/font-bold.woff2') format('woff2'), url('path/to/font-bold.woff') format('woff'), url('path/to/font-bold.ttf') format('truetype'); font-weight: 700; }
This code will load the regular weight of the font when you use `font-weight: 400` in your CSS and the bold weight when you use `font-weight: 700`.
How can I optimize my fonts for better website performance?
You can optimize your fonts for better website performance by using a font format like WOFF2, which is generally smaller in file size than other font formats. You can also use a font optimization tool to further reduce the file size of your font files.
Will adding custom fonts slow down my website?
Adding custom fonts can slow down your website if they are not loaded efficiently. However, if you use a method like Google Fonts or Adobe Fonts, which serve fonts from their optimized servers, you should not see a significant impact on your website’s performance.
How can I add a custom font to my WordPress site title?
You can add a custom font to your WordPress site title by using the following CSS code:
.site-title { font-family: 'MyCustomFont', Arial, sans-serif; font-size: 3em; }
Replace `’MyCustomFont’` with the actual name of your custom font. You can add this code to your theme’s stylesheet or use a custom CSS plugin to add it.
What are some of the popular Google Fonts?
Some popular Google Fonts include:
- Open Sans
- Roboto
- Lato
- Poppins
- Raleway
- Montserrat
Where can I find more information about using custom fonts in WordPress?
For more information about using custom fonts in WordPress, visit the WPBeginner website. You can also search for tutorials on YouTube and other resources like the WordPress Codex.
If you’re interested in learning more about tech news, feel free to visit my website: www.naveedahmed.me.