【问题标题】:Changing Font in Wordpress Theme更改 Wordpress 主题中的字体
【发布时间】:2018-02-06 18:34:07
【问题描述】:

我目前正在使用 Wordpress 'Square' 主题:https://hashthemes.com/wordpress-theme/square/

我希望修改导航菜单、下拉菜单和帖子/页面中的字体。

我有我想要的字体的真实类型文件,但我不确定我应该如何修改 CSS 来实现我想要的。

感谢任何帮助!

谢谢,

【问题讨论】:

  • 你试过他们的文档吗? - hashthemes.com/documentation/square-documentation
  • @RasmusGlenvig 我查看了文档并在他们的支持论坛上提交了同样的问题。但没有运气。原来我可能必须从开发人员那里购买一个子主题才能完全自定义主题,

标签: html css wordpress fonts wordpress-theming


【解决方案1】:

您可以尝试在 style.css 或自定义 css 文件中添加字体系列,我在我的主题中使用了这个真正的类型脚本,就像这样

<script src="https://use.typekit.net/uhs1xwe.js"></script>
<script>try{Typekit.load({ async: true });}catch(e){}</script>

在 css 文件中我使用了这样的字体

.header_menu ul li {
    float: left;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 1px;
    font-weight: 500;
    padding: 0 18px 0 0;
    font-family: "sofia-pro";
}

【讨论】:

  • 我需要使用'script src'标签吗?我已将所需字体的 ttf 上传到我的 wordpress 服务器中的指定字体文件夹。以为它已经安装/上传,可以使用了。
  • 这是我添加真实类型字体的方式,或者如果您在字体文件夹中添加了 ttf 字体,那么您可以添加 css 请在此处粘贴您拥有的内容
【解决方案2】:

在 style.css 中,这样写:

@font-face {
font-family: FontName;  
src: url(public_html/your-site/wp-content/themes/your-theme/fonts/FontName-Regular.ttf);  
font-weight: normal;  
}

然后使用

body{font-family: FontName !important;}

见这里http://www.wpbeginner.com/wp-themes/how-to-add-custom-fonts-in-wordpress/ https://premium.wpmudev.org/blog/custom-fonts-css/?utm_expid=3606929-109.P6e7JvhjTrWFxwrJZjRkog.0&utm_referrer=https%3A%2F%2Fwww.google.co.in%2F

【讨论】:

  • 请告诉我使用后会发生什么。
猜你喜欢
  • 2016-08-06
  • 2014-03-12
  • 2011-12-15
  • 1970-01-01
  • 1970-01-01
  • 2012-11-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多