Font-Awesome:试图让这个东西与 WordPress 一起工作

Font-Awesome: Trying to make this thing work with WordPress

我正在尝试让 Font-Awesome 与我的自托管 WordPress 博客(debian 机器)一起工作

到目前为止我尝试过的:

将此插入 /usr/share/wordpress/.htaccess and\or /etc/apache2/sites-available/wordpress.conf and\or /etc/apache2/proxy.conf

<IfModule mod_headers.c>                                                                                         
    <FilesMatch "\.(eot|font.css|otf|ttc|ttf|woff)$">                                                        
            Header set Access-Control-Allow-Origin "*"                                                       
    </FilesMatch>                                                                                            
</IfModule>    

我试过将它插入 theme.css and\or 自定义 CSS and\or 通过 Chrome 调试控制台手动编辑。

@font-face {
    font-family: 'FontAwesome';  src: url('../font/fontawesome-webfont.eot?v=4.5.2');  
    src: url('../font/fontawesome-webfont.eot?#iefix&v=4.5.2') format('embedded-opentype'), url('../font/fontawesome-webfont.woff?v=4.5.2') format('woff'), url('../font/fontawesome-webfont.ttf?v=4.5.2') format('truetype'), url('../font/fontawesome-webfont.svg?v=4.5.2#fontawesomeregular') format('svg');
    font-weight: normal;  font-style: normal;
}

我现在确定我已经尝试了所有的组合,所有导入的font-awesome.css和font awesome font都是4.5.2版本

我必须做些什么才能使这个东西起作用?

我的网站 link 是 http://gun-gummybears.it/?page_id=414,如您所见,font-awesome 无法正常工作。

我找到了一些您可能会觉得有用的东西。看起来有些东西没有安排妥当。试一试。

这是我发现的:

<FilesMatch "\.(ttf|otf|eot|woff|font.css)$">
  <IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
  </IfModule>
</FilesMatch>

# webfont mime types
AddType application/vnd.ms-fontobject  eot
AddType font/truetype                  ttf
AddType font/opentype                  otf
AddType application/x-font-woff              woff

# webfonts and svg:
<IfModule mod_deflate.c>
  <FilesMatch "\.(ttf|otf|eot|svg)$" >
    SetOutputFilter DEFLATE
  </FilesMatch>
</IfModule>

如果仔细观察标签 FilesMatch 和 IfModule 的顺序已经调换了。我们还为每个文件扩展名使用了 AddType。

此文本应放在 Wordpress 根目录下的 .htaccess 文件中。

这是此内容的来源: https://gist.github.com/WheresAlice/843983

这可以标记为已解决,Ryan Scott Cady 的帖子解决了我的问题。

但是还有另一个错误,我有一个插件覆盖了我网站上每个字体上的 FontFamily,我删除了这个插件,一切正常。

只是想让你知道有问题的插件是一个名为 "twitch embed plugin"

的插件

转到 header.php 文件(或者 where-ever 你保留你的 header 代码)并粘贴下面的嵌入代码:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">