我正在尝试解决以下问题:自定义字体(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
答案 0 :(得分:0)
好吧,最后一直都是@ font-face,只是隐藏在我的搜索工具无法访问的文件中。对不起,谢谢您的帮助!解决方案可以在其他地方找到:Google Web Fonts on HTTPS pages on Chrome