css - 自定义字体(不使用@font-face)不会在 HTTPS 协议上加载
问题描述
我正在尝试解决一个问题,即我的自定义字体 (ArcaMojora) 未在 HTTPS 协议上加载,并且我在各处看到了大量使用 @font-face 的代码的修复。在大力搜索我的 WP 主题文件后,我意识到我的主题(Kleanity)根本不使用@font-face,而是在代码下方。
如何调整代码以使自定义字体与 HTTPS 以及 HTTP 一起加载?
任何和所有的帮助表示赞赏!
// add filter to register custom fonts for font lists
add_filter('gdlr_core_custom_uploaded_font', 'kleanity_register_custom_uploaded_font');
if( !function_exists('kleanity_register_custom_uploaded_font') ){
function kleanity_register_custom_uploaded_font( $custom_fonts ){
$custom_font = kleanity_get_option('typography', 'font-upload');
if( !empty($custom_font) ){
foreach($custom_font as $font_option){
$custom_fonts[$font_option['name']] = array(
'eot' => $font_option['eot'],
'ttf' => $font_option['ttf'],
);
}
}
$custom_fonts['ArcaMojora'] = array(
'name' => 'ArcaMojora',
'eot' => get_template_directory_uri() . '/fonts/ArcaMajora/ArcaMajora3-Bold.eot',
'ttf' => get_template_directory_uri() . '/fonts/ArcaMajora/ArcaMajora3-Bold.ttf',
'font-weight' => 600
);
$custom_fonts['ArcaMojora-Heavy'] = array(
'name' => 'ArcaMojora',
'eot' => get_template_directory_uri() . '/fonts/ArcaMajora/ArcaMajora3-Heavy.eot',
'ttf' => get_template_directory_uri() . '/fonts/ArcaMajora/ArcaMajora3-Heavy.ttf',
'font-weight' => 800,
'varient' => true
);
return $custom_fonts;
} // kleanity_register_custom_uploaded_font
} // function_exists
解决方案
好吧,最后它一直是@font-face,只是隐藏在我的搜索工具无法访问的文件中。很抱歉,感谢您的帮助!可以在其他地方找到解决方案:Chrome 上 HTTPS 页面上的 Google Web Fonts
推荐阅读
- python - 安装时是否可以使 setuptool 将二进制文件设置为可执行文件
- python - 如何合并我在 Python 中导入的文件中的行?
- sql - 执行查询并从 sql 和 Hive 获取结果的 Oozie 解决方案
- c - 从另一个线程更新 Gtk+2 文本视图小部件
- python-3.x - MissingSchema - 请求模块的无效 URL 错误
- javascript - 我无法存储来自 setBackgroundMessageHandler 的数据
- google-chrome - 为什么清除缓存解决“ERR_CONNECTION_TIMED_OUT”?
- python - Pytest 通过测试我认为它应该在 sys.exit() 调用上失败
- php - 使用fwrite()在带有内部数组的php文件中添加变量?
- sorting - 如何修复我的代码,以便它打印矩阵中的最大值和最小值?