簡體   English   中英

在Wordpress中使用HTML格式的自定義字體

[英]using custom fonts in HTML format in wordpress

我遵循了有關如何將字體上傳到wordpress的教​​程(請參見下面的鏈接)。 我已經完成了所有步驟,包括上傳到ftp,更改header.php以包括字體樣式表等,如以下鏈接所示:

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

我添加到header.php的內容 (我相信我已正確更改了所有所需內容):

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

1)讓我感到困惑的是步驟11-12。 我只是試圖在頁面中調出我的字體,但是它不起作用....我不知道在我的wordpress主題的主樣式表中需要放置什么內容...

@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)我不確定我是否正確調用了字體:

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

您能提供給我的任何東西都會極大地幫助您。

您應該在您的functions.php文件中注冊和加入樣式。

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

wp_enqueue_style( 'aileron' );

您使用哪個瀏覽器查看您的網站? 一些瀏覽器需要特定的字體格式:

見鏈接

自定義字體是否與樣式表位於同一文件夾中?

除非未加載樣式表,否則應正確調用字體。 您可以在瀏覽器中檢查源代碼,以查看是否加載了樣式表。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM