Adding custom fonts to your WordPress website can significantly enhance its visual appeal and brand identity. While there are many plugins available to simplify this process, it?s entirely possible to add custom fonts without using a plugin. This article will guide you through the steps to add custom fonts manually, ensuring your site stands out with unique typography.
Custom fonts can help you:
Adding custom fonts involves a few key steps: choosing a font, uploading the font files to your server, and then integrating the fonts into your WordPress theme using CSS.
First, you need to select the custom font you want to use. There are several sources for free and premium fonts:
Download the font files (usually .ttf, .woff, .woff2, and .eot formats) from these sources.
Next, you need to upload the font files to your WordPress server:
wp-content/themes/your-theme-name
) and create a new folder called fonts
.fonts
directory.To use the custom fonts on your website, you need to declare them in your CSS file:
Appearance
> Theme Editor
.style.css
file of your active theme.style.css
file, add the following code to declare your custom fonts:
{
font-family: 'CustomFont';
src: url('fonts/customfont.eot');
src: url('fonts/customfont.eot?#iefix') format('embedded-opentype'),
url('fonts/customfont.woff2') format('woff2'),
url('fonts/customfont.woff') format('woff'),
url('fonts/customfont.ttf') format('truetype'),
url('fonts/customfont.svg#CustomFont') format('svg');
font-weight: normal;
font-style: normal;
}
Replace 'CustomFont'
with the name of your font, and adjust the file paths if necessary.
Now that the custom font is declared in your CSS, you can apply it to various elements on your site:
style.css
file, add CSS rules to apply the custom font to specific HTML elements:
body {
font-family: 'CustomFont', sans-serif;
}
h1, h2, h3, h4, h5, h6 { font-family: 'CustomFont', sans-serif; }
You can customize which elements use the custom font by modifying the CSS selectors.
After adding the custom font to your CSS, it?s crucial to test your site:
body {
font-family: 'CustomFont', Arial, sans-serif;
}
Adding custom fonts to your WordPress site without a plugin allows for greater customization and can enhance your site?s design and branding. By following these steps?choosing a font, uploading it to your server, declaring it in your CSS, and applying it to your site?you can ensure your website stands out with unique typography. Remember to test your site across different browsers and devices to ensure the custom fonts are displayed correctly. With these techniques, you can elevate your WordPress site?s aesthetic and user experience.