Local hosting of Google Fonts on your website can be a great way to improve your website’s performance and user experience. When you use Google Fonts, the actual font file is hosted on Google’s server, which can slow down your website and negatively impact user experience. By hosting the font files locally, you can avoid this issue and ensure that your website loads quickly and smoothly.
If you’re using Divi, there are several benefits to hosting Google Fonts locally. First, it can help you reduce the number of external domains your website is depending on, which can improve your website’s performance. Second, it gives you full control over caching, which can help you optimize your website’s performance even further. Third, it eliminates the need to rely on third-party services, which can be unreliable and slow.
When you host Google Fonts locally, you can also enjoy greater flexibility and customization options. For example, you can choose which fonts to use and how to use them, rather than relying on Google’s pre-defined options. You can also customize the fonts to match your website’s branding and design, which can help you create a more cohesive and professional look.
Overall, hosting Google Fonts locally can be a great way to improve your website’s performance, user experience, and customization options. If you’re using Divi, it’s definitely worth considering. I hope this helps! 😊
Search for "Google Webfonts Helper" to find the site to download your fonts.
/*
PHP. Add this in your CHILD THEME
functions.php after the existing content.
Backup first!
*/
add_filter( 'wp_check_filetype_and_ext', 'my_file_and_ext_woff', 10, 4 );
function my_file_and_ext_woff( $types, $file, $filename, $mimes ) {
if ( false !== strpos( $filename, '.woff' ) ) {
$types['ext'] = 'woff';
$types['type'] = 'font/woff|application/font-woff|application/x-font-woff|application/octet-stream';
}
if ( false !== strpos( $filename, '.woff2' ) ) {
$types['ext'] = 'woff2';
$types['type'] = 'font/woff2|application/octet-stream|font/x-woff2';
}
return $types;
}
/* Mime Types Support */
add_filter('upload_mimes', 'custom_mime_types', 999999);
function custom_mime_types($mimes) {
$mimes['woff'] = 'application/font-woff';
$mimes['woff2'] = 'application/font-woff2';
return $mimes;
}
/* Custom Font Types Support */
add_filter('et_pb_supported_font_formats', 'custom_font_formats', 1);
function custom_font_formats() {
return array('woff', 'woff2');
}
// End
00:00 Introduction
00:51 Default Setting
01:28 Disable Google Fonts
02:01 Chooing Your Fonts
03:37 Downloading Your Fonts
05:57 Extracting Files
06:45 Installing To Divi
08:22 Editing functions.php
09:48 Uploading The Fonts
11:34 Setting Default Fonts
Информация по комментариям в разработке