字体未在Wordpress网站上呈现

时间:2019-12-19 08:01:46

标签: html css wordpress

我创建了一个纯HTML网站,其中包含一个用WordPress开发的博客部分。我已经使用“ PostGrid”插件显示了类似网格的结构,并在WordPress中使用了“帖子”部分,该部分允许在该博客部分添加帖子。

我面临的问题是: enter image description here

在上面的图像中,字体正确显示,但在第二页上却不显示。

enter image description here

在以下URL http://localhost/wordpress/home/上,我拥有所有博客。在此页面上,我最多可以添加六个帖子,如果我添加更多博客,则它会添加到下一页,因为WordPress提供了内置的分页支持。

我在上述URL上添加的博客适用于自定义字体,但是如果我添加更多帖子/博客,则转到下一页,即http://localhost/wordpress/home/page/2/,此处的字体不会呈现并显示控制台错误。

  

获取http://localhost/wordpress/home/page/fonts/Gilroy-Semibold.ttf   net :: ERR_ABORTED 404(未找到)。

帖子首页和页面2的字体路径都相同,但是在页面2上却没有呈现。

我已经尝试了所有解决方案,方法是在控制台上添加CSS,还从WordPress的Simple CSS更改了CSS,但未加载。

有人可以帮我解决这个问题,我将分享代码。

我正在WordPress的简单CSS中使用下面的CSS,并且两个博客页面的CSS相同。

@font-face {
    font-family:gilroylight;
    src: url("../fonts/Gilroy-Light.ttf");

  }
@font-face {
    font-family:gilroysemibold;
    src: url("../fonts/Gilroy-Semibold.ttf");
  }
@font-face {
    font-family:keepcalm;
    src: url("../fonts/KEEPCALM-MEDIUM_0.TTF");
}

2 个答案:

答案 0 :(得分:1)

字体文件存在路径问题,请在控制台窗口中检查它。并以样式/ css更改路径/ URL。

$result=unanswered2($input,$answers);

  $result= [
    (object)[
        'id'       => 2,
        'number'   => 54523,
        'date'     => '2019-12-17',
        'book_for' => 'tttt',
        'subject'  => 'tttt',
        'content'  => 'ttt',
        'language' => 'Arabic',
        'cpfor'    => 'tt',
        'book_key' => '2WHae',
        'note'     => 'ttt',
        'type'     => 'Internal',
        'pid'      => 2,
        'bookid'   => 2,
        'process'  => 'STA',
    ],
];

希望有帮助。

答案 1 :(得分:0)

使用您的CSS样式:根据您的路径替换src和字体系列

@font-face {
  font-family: Roboto;
  src: url(http://localhost/wordpress/wp-content/themes/twentyseventeen-child/fonts/Roboto-Regular.ttf);
  font-weight: normal;
}