Custom Fonts

In this section, you can set the custom fonts by uploading the font-related files ex. .woff, .woff2, .ttf etc.

For example, if you select Bank Nue font family, so you can use the uploaded font family as following CSS. To add the following CSS you can use the child-theme or custom CSS in theme options.

.selector {
  font-family: 'Bank Nue';
}

WordPress allows you to upload the most common image files, audio/ video, PDF, Microsoft Office and OpenOffice documents. WordPress codex has a full list of allowed file types and extensions.

Security is the main reason behind the limitation on file types that users can upload. However, this does not mean that users cannot change this. Using a tiny bit of code, you can add a new file type and extension to WordPress.

For example, add this code in your child theme’s functions.php file or a site-specific plugin to allow font files type to be uploaded:

function webgatha_child_mimes_types( $mime_types ) {
  $mime_types['otf'] = 'application/x-font-otf';
	$mime_types['woff'] = 'application/x-font-woff';
	$mime_types['woff2'] = 'application/x-font-woff2';
	$mime_types['ttf'] = 'application/x-font-ttf';
	$mime_types['svg'] = 'image/svg+xml';  
	
	return $mime_types;
}
add_filter( 'upload_mimes', 'webgatha_child_mimes_types' );
Suggest Edit