【问题标题】:Where to place font awesome folder 'font' in wordpress theme directory?在wordpress主题目录中放置字体真棒文件夹'font'的位置?
【发布时间】:2020-10-31 17:23:38
【问题描述】:

大家好,我想在我的 wordpress 主题中手动添加字体真棒我已经链接了 fontawesome css 并将字体文件夹放在

D:\xampp\htdocs\wordpress2\wp-content\themes\twentysixteen

但是 font awesome 不适用?

【问题讨论】:

  • 您在控制台中是否遇到任何错误?
  • 你在标题中设置了字体真棒CSS路径吗?
  • @RajKumarBhardwaj 是的,我确实在 functions.php 文件中的函数二十六位脚本()中设置了它。
  • 你能把你给functions.php的路径粘贴到这里吗
  • @RajKumarBhardwaj wp_enqueue_style('font-awesome.min', get_template_directory_uri() .'/css/font-awesome.min.css');

标签: css wordpress wordpress-theming font-awesome


【解决方案1】:

为了更好的响应。

请访问http://fontawesome.io/官方网站并下载字体真棒文件夹。[我附上图片以正确理解。请查看附件][1]。 [1]:https://i.stack.imgur.com/9NCHz.png

现在将所有字体文件放入您的主题字体文件夹中。 并使用@font face 像这样添加css:

@font-face {
font-family: 'fontawesome';
src: url('../fonts/fontawesome/fontawesome-webfont.ttf') format('truetype');

}

还可以将 css font-awesome.min.css 库放入您的主题 css 文件夹并附加在函数.php 或 header.php 中的 head 部分。

希望对你有帮助。

谢谢

【讨论】:

    【解决方案2】:

    你还需要添加这条规则,

    fa fas{ font-family: 'Font Awesome 5 Free' !important; 
        font-size:16px !important; 
    } 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-01
      • 2014-05-02
      • 1970-01-01
      • 2016-09-18
      • 1970-01-01
      • 2013-02-28
      • 1970-01-01
      • 2013-12-15
      相关资源
      最近更新 更多