【发布时间】:2020-07-12 04:40:39
【问题描述】:
我正在使用 wp_enqueue_style 来排队 this Google Font file。这是我的代码:
wp_enqueue_style( 'google-fonts', 'https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,700;1,400&family=Neuton:ital,wght@0,300;0,400;0,700;1,400&display=swap', [] );
这是在我的functions.php文件中。
但是,当我在加载的页面上查看源代码时,该字体文件的 URL 被缩减为:https://fonts.googleapis.com/css2?family=Neuton%3Aital%2Cwght%400%2C300%3B0%2C400%3B0%2C700%3B1%2C400&display=swap&ver=5.3.2
如您所见,通过wp_enqueue_style 输出后,第一个family 参数已被删除。有没有办法在不做任何事情的情况下解决这个问题?我认为可能有一种过时的方式来构建两个字体系列的 URL,但我宁愿能够使用谷歌现在提供的东西。我在wp_enqueue_style 中的原始 URL 是 Google Fonts 生成的供我嵌入的 URL。
【问题讨论】:
标签: php css wordpress fonts google-fonts