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 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!