简体   繁体   English

如何更改WordPress网站的整体字体?

[英]How to change the overall font of WordPress site?

I am using Duster as my theme.我使用 Duster 作为我的主题。 I want to change the default font.我想更改默认字体。 Is there any way to do that?有没有办法做到这一点?

You can use Easy Google Fonts Plugin您可以使用Easy Google Fonts 插件

Step 1 install plugin and then go to => setting => google fonts .第 1 步安装插件,然后转到 => setting => google fonts 。 Add a css selector like if you want to change the whole website font family change , then add a body css selector .添加一个 css 选择器,就像你想改变整个网站字体系列一样,然后添加一个 body css 选择器。

step 2 Go to => Apperance => customize => Typography => Theme Typography => add a font family you want to use .第 2 步转到 => 外观 => 自定义 => 排版 => 主题版式 => 添加要使用的字体系列。

...or, if you don't like plugins, simply do this and add stylesheet with it after all the other stylesheets in header: ...或者,如果您不喜欢插件,只需执行此操作并在标题中的所有其他样式表之后添加样式表:

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

If this doesn't work and is overriden change to font-family:Whatever, "Whatever In Space", sans-serif !important;如果这不起作用并且被覆盖更改为font-family:Whatever, "Whatever In Space", sans-serif !important; , but using !important is generally considered a last resort. , 但使用!important通常被认为是最后的手段。

If you want to change the font without using any plugin, you can follow the steps below:如果您想在不使用任何插件的情况下更改字体,可以按照以下步骤操作:

  1. For example if you want to change fonts to BYekan or any other fonts, you have to create a font folder in wp-content->themes->my theme->font .例如,如果要将字体更改为 BYekan 或任何其他字体,则必须在wp-content->themes->my theme->font创建一个字体文件夹。
  2. Upload the fonts to this folder.将字体上传到此文件夹。
  3. In beginning of the CSS file, add these lines:在 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. Change font-family to:font-family更改为:

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

    everywhere you want to change the font.任何你想改变字体的地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM