Avada使用自定义字体

1、先通过下面链接下载最新和需要的 Google 字体,因为直接从 fonts.google.com 下载不现实,除非你会爬墙过去。

https://google-webfonts-helper.herokuapp.com/

首先下载需要的字体并解压到电脑上方便后面上传

2、将ALLOW_UNFILTERED_UPLOADS常量添加到wp-config.php
打开wp-config.php你的WordPress安装文件,并在其上面 /* That’s all, stop editing! Happy blogging. */添加以下代码的地方:

define( 'ALLOW_UNFILTERED_UPLOADS', true );

3.主题Avada function.php文件添加代码方便后面后台媒体库中上传
function my_custom_upload_mimes1($mimes1 = array()) {

// Add a key and value for the SVG file type
$mimes1['TTF'] = "text/TTF";

return $mimes1;
}

add_action('upload_mimes1', 'my_custom_upload_mimes1');

function my_custom_upload_mimes2($mimes2 = array()) {

// Add a key and value for the SVG file type
$mimes2['WOFF'] = "text/WOFF";

return $mimes2;
}

add_action('upload_mimes2', 'my_custom_upload_mimes2');

function my_custom_upload_mimes3($mimes3 = array()) {

// Add a key and value for the SVG file type
$mimes3['WOFF2'] = "text/WOFF2";

return $mimes3;
}

add_action('upload_mimes3', 'my_custom_upload_mimes3');

function my_custom_upload_mimes4($mimes4 = array()) {

// Add a key and value for the SVG file type
$mimes4['SVG'] = "text/SVG";

return $mimes4;
}

add_action('upload_mimes4', 'my_custom_upload_mimes4');

function my_custom_upload_mimes5($mimes5 = array()) {

// Add a key and value for the SVG file type
$mimes5['EOT'] = "text/EOT";

return $mimes5;
}

add_action('upload_mimes5', 'my_custom_upload_mimes5');

4

转载请注明本文链接:https://blog.weixiaoline.com/1688.html