dssu33392 2014-04-23 22:38
浏览 82
已采纳

在wordpress中使用HTML格式的自定义字体

I followed a tutorial on how to upload fonts to wordpress (see link below). I've done all the steps including uploading to the ftp, changing header.php to include the font stylesheet, etc as lined out in the below link:

http://www.wphub.com/tutorials/adding-custom-fonts-wordpress-website/

what i added to header.php (I believe I changed everything I needed to correctly):

<link rel="stylesheet”  href="<?php bloginfo('template_directory'); ? >/aileron/stylesheet.css"></li>

1) What's confusing me is Steps 11-12. I just tried to call out my font in a page but it did not work….i don't know what needs to be placed in the main style sheet for my wordpress theme…

@font-face {
font-family: 'aileronblack';
src: url('aileron-black-webfont.eot');
src: url('aileron-black-webfont.eot?#iefix') format('embedded-opentype'),
     url('aileron-black-webfont.woff') format('woff'),
     url('aileron-black-webfont.ttf') format('truetype'),
     url('aileron-black-webfont.svg#aileronblack') format('svg');
font-weight: normal;
font-style: normal;

}

2) i'm not sure I'm calling out the fonts correctly:

<span style="font-family: 'aileronblack';"> Test</span>

Anything you can provide me will help immensely.

  • 写回答

1条回答 默认 最新

  • dousong1992 2014-04-23 23:07
    关注

    You should register and enqueue your styles in your functions.php file.

    wp_register_style( 'aileron', get_template_directory_uri() . '/aileron/stylesheet.css', array(), '1.0', 'all' );
    
    wp_enqueue_style( 'aileron' );
    

    Which browser are you using to view your site? Some browser need specific font format:

    See link

    Are the custom fonts located in the same folder as the stylesheet?

    Your font should be called correctly, unless the stylesheet isn't loaded. You can check the source code in a browser to see if the stylesheet is getting loaded.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
  • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000
  • ¥30 ppOCRLabel导出识别结果失败
  • ¥15 Centos7 / PETGEM