在function.php中导入Wordpress主题中的自定义字体

时间:2015-07-18 00:40:01

标签: css wordpress fonts

我想在自定义Wordpress中使用自定义字体(@fontface)。我在我的functions.php中引入了谷歌字体,如此

wp_enqueue_style( 'Lato', '//fonts.googleapis.com/css?family=Lato:300,400,700,900', array() );

但想使用我的字体文件夹中的字体(theme-name / fonts / ...)我不知道怎么做,我通常会使用@fontface ...但不确定它如何与Wordpresss一起使用

编辑我想把它带进我的functions.php文件

2 个答案:

答案 0 :(得分:0)

使用css导入它:

<link type="text/css" rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:300,400,700,900'" />

然后可以使用:

font-family: 'Lato', sans-serif;

答案 1 :(得分:0)

modified to string

在css中使用字体:

@font-face {
font-family: 'give-any-name-to-font-famaly';
src: url('font-name.eot');
src: url('font-name.eot?#iefix') format('embedded-opentype'),
url('font-name.woff') format('woff'),
url('font-name.ttf') format('truetype'),
url('font-name.svg#font-name') format('svg');
font-weight: normal;
font-style: normal;
}
相关问题