I have a font file SHRIMP.ttf and I want to put it in WordPress, how can I do it?
- User
I have a font file SHRIMP.ttf and I want to put it in WordPress, how can I do it?
- Assistant
I have a font file SHRIMP.ttf and I want to put it in WordPress, how can I do it?
To use a custom font like SHRIMP.ttf in your WordPress site, follow these steps:
SHRIMP.ttf file.You have two primary methods to load your custom font in WordPress: using a child theme or through a custom CSS section.
Create or Access Your Child Theme. If you don't already have a child theme, create one.
Add the Font to Your Stylesheet. Locate the style.css file within your child theme, and enqueue the font. You can do this by adding the following code:
@font-face {
font-family: 'Shrimp';
src: url('YOUR_FONT_URL/SHRIMP.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
/* Example usage */
body {
font-family: 'Shrimp', sans-serif;
}
Make sure to replace YOUR_FONT_URL/SHRIMP.ttf with the actual URL you copied from the media library.
Edit functions.php (if needed): Sometimes it's necessary to load the CSS through functions.php. If so, add this code to enqueue your stylesheet:
function my_custom_fonts() {
wp_enqueue_style('custom-fonts', get_stylesheet_directory_uri() . '/style.css');
}
add_action('wp_enqueue_scripts', 'my_custom_fonts');
Go to 'Appearance' > 'Customize'.
Find 'Additional CSS' (or a similar option).
Add Custom CSS:
Insert the CSS code mentioned earlier that contains the @font-face declaration and the desired styling:
@font-face {
font-family: 'Shrimp';
src: url('YOUR_FONT_URL/SHRIMP.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
/* Example usage */
body {
font-family: 'Shrimp', sans-serif;
}
Publish Your Changes.
After completing the above steps, visit your website to check if the custom font is applied correctly. If you see the font style applied, you have successfully added your custom font to your WordPress site.
.woff, .woff2, .eot, and .svg) for wider compatibility. You can use online services or font conversion tools to generate these files.Not yet included in a published release.