【问题标题】:How to change the overall font of WordPress site?如何更改 WordPress 网站的整体字体?
【发布时间】:2016-10-20 14:47:49
【问题描述】:

我使用 Duster 作为我的主题。我想更改默认字体。有什么办法吗?

【问题讨论】:

  • 我投票决定将此问题作为离题结束,因为应该在 wordpress 网站上

标签: css wordpress fonts wordpress-theming


【解决方案1】:

您可以使用Easy Google Fonts Plugin

步骤 1 安装插件,然后转到 => 设置 => google fonts 。添加一个 css 选择器,如果您想更改整个网站的字体系列更改,然后添加一个 body css 选择器。

第 2 步 转到 => 外观 => 自定义 => 排版 => 主题排版 => 添加您要使用的字体系列。

【讨论】:

    【解决方案2】:

    ...或者,如果您不喜欢插件,只需执行此操作并在标题中的所有其他样式表之后添加样式表:

    body {
        font-family:Whatever, "Whatever In Space", sans-serif; /* Actual fonts of course chosen by you */
    }
    

    如果这不起作用并被覆盖更改为font-family:Whatever, "Whatever In Space", sans-serif !important;,但使用!important 通常被认为是最后的手段。

    【讨论】:

      【解决方案3】:

      如果您想在不使用任何插件的情况下更改字体,可以按照以下步骤操作:

      1. 例如,如果要将字体更改为 BYekan 或任何其他字体,则必须在 wp-content->themes->my theme->font 中创建一个字体文件夹。
      2. 将字体上传到此文件夹。
      3. 在 CSS 文件的开头,添加以下行:

        @font-face {
            font-family: 'BYekan';
            src: url('font/WebYekan.eot');
            src: url('font/WebYekan.eot?#iefix') format('embedded-opentype'),
                 url('font/WebYekan.woff') format('woff'),
                 url('font/WebYekan.ttf') format('truetype'),
                 url('font/WebYekan.svg#WebYekan') format('svg');
            font-weight: normal;
            font-style: normal;
        }
        @font-face {
            font-family: 'BKoodakBold';
            src: url('font/BKoodakBold.eot');
            src: url('font/BKoodakBold.eot?#iefix') format('embedded-opentype'),
                 url('font/BKoodakBold.ttf') format('truetype');
            font-weight: normal;
            font-style: normal;
            -moz-font-feature-settings: "calt=0,liga=0";
        }
        
      4. font-family 更改为:

        font-family:"BKoodakBold",BKoodak,byekan,Arial,Helvetica Neue,sans-serif;
        

        任何你想改变字体的地方。

      【讨论】:

        猜你喜欢
        • 2019-06-25
        • 2012-04-17
        • 2017-05-23
        • 2014-11-15
        • 1970-01-01
        • 1970-01-01
        • 2012-07-28
        • 2020-09-04
        • 2020-12-02
        相关资源
        最近更新 更多