Archived topic
Uploading Custom Fonts
5 replies · Started by Vladimir on November 11, 2022
Hi,
I have custom fonts sent to me as .zip file. They were licensed from some 3rd party.
Where in the Interface do I upload such custom fonts and do I upload them as zip file, or I have to unzip them first and upload them then?
Vlad
Hi there,
Follow the instructions here:
https://docs.generatepress.com/article/adding-local-fonts/
I followed instructions and added extra snippet to allow font uploads to Media by adding this code to new snippet.
add_filter( 'upload_mimes', function( $mimes ) {
$mimes['woff'] = 'application/x-font-woff';
$mimes['woff2'] = 'application/x-font-woff2';
$mimes['ttf'] = 'application/x-font-ttf';
$mimes['svg'] = 'image/svg+xml';
$mimes['eot'] = 'application/vnd.ms-fontobject';
return $mimes;
} );
But when I try to upload .ttf file, it does not allow me to upload despite the the function. Here is the error message I get.
“Antenna Regular.ttf” has failed to upload.
Sorry, you are not allowed to upload this file type.
Are there any other ways to get that .ttf file into the website?
Hi there,
do you have .woff and .woff2 copies of the font ?
If so just use those - as they are supported by all modern browsers so the TTF isn't required.
Great advice on .woff font types. Thank you. Closing ticket.
Glad to be of help!