我正在开发一个Wordpress主题;我导入了许多样式表和一些Google字体,在MAC上一切都很好,但是当我在Windows上测试我的站点时,它不是检测我的Google字体,而是尝试了几种方法将它导入到我的functions.php文件中,但是结果是相同的。我在Edge,Chrome和Firefox上做过测试,而且它也有同样的问题。
我试过:
style.css导入@import文件-没有结果。wp_register_style和wp_enqueue_style注册样式-没有结果。我将把我的functions.php文件放在下面。
function wp_bulldoezer_styles() {
wp_register_style('raleway', 'http://fonts.googleapis.com/css?family=Raleway:400,300,500,600,700,800');
wp_register_style('hind', 'http://fonts.googleapis.com/css?family=Hind:400,300,500,600,700');
$query_args = array(
'family' => 'Raleway:400,300,500,600,700,800|Hind:400,300,500,600,700',
);
wp_register_style( 'google-fonts', add_query_arg( $query_args, "//fonts.googleapis.com/css" ), array(), null );
wp_enqueue_style('google-fonts');
wp_enqueue_style('raleway');
wp_enqueue_style('hind');
}
add_action('wp_enqueue_scripts', 'wp_bulldoezer_styles');在我的CSS文件中:
@import url(http://fonts.googleapis.com/css?family=Raleway:400,300,500,600,700,800);
@import url(http://fonts.googleapis.com/css?family=Hind:400,300,500,600,700);您可以在这个URL上测试这个站点,我想导入的字体是拉利威和Hind,这两种字体都可以在谷歌字体上使用。
你们可以帮我解决这个问题--这有点麻烦。
致以问候!
发布于 2015-12-13 07:38:18
内容在iframe中呈现。<head>中包含的所有资源都不能在iframe中使用。当然,这包括所有的CSS,因此,也包括字体。
https://stackoverflow.com/questions/34248469
复制相似问题