Wordpress:自定义字体不起作用

时间:2015-08-15 10:15:46

标签: php html css wordpress fonts

我的wordpress网站上的自定义字体有问题,它仅适用于主页,但当你继续使用http://domainname.com/about字体停止工作等任何子页面时。

请寻求帮助。

这是用于传递字体的css:

    @font-face {
font-family: 'TrajanPro-Bold';
src: url("wp-content/fonts/TrajanPro-Bold.otf");
src: url("wp-content/fonts/TrajanPro-Bold.otf?#iefix") format('opentype');
font-weight: bold;
font-style: normal; }

@font-face {
font-family: 'AVENIRNEXT-BOLD';
src: url("wp-content/fonts/AVENIRNEXT-BOLD.OTF");
src: url("wp-content/fonts/AVENIRNEXT-BOLD.OTF?#iefix") format('opentype');
font-weight: bold;
font-style: normal; }

@font-face {
font-family: 'AVENIRNEXT-ITALIC';
src: url("wp-content/fonts/avit.otf");
src: url("wp-content/fonts/avit.otf?#iefix") format('opentype');
font-weight: normal;
font-style: italic; }

@font-face {
font-family: 'AVENIRNEXT-REGULAR';
src: url("wp-content/fonts/AVENIRNEXT-REGULAR.OTF");
src: url("wp-content/fonts/AVENIRNEXT-REGULAR.OTF?#iefix") format('opentype');
font-weight: normal;
font-style: normal; }


@font-face {
font-family: 'JaneAust';
src: url("fonts/JaneAust.ttf");
src: url("wp-content/fonts/JaneAust.ttf?#iefix") format('truetype');
font-weight: normal;
font-style: normal;
}

1 个答案:

答案 0 :(得分:2)

这是因为URL wp-content/fonts/TrajanPro-Bold.otf将相对于当前页面目录。

通过向所有网址添加前导slash /来使路径成为绝对路径。

示例:/wp-content/fonts/TrajanPro-Bold.otf