我正在使用wp_enqueue_style
来引入 这个Google字体文件。这是我的代码:
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
正如你所看到的,第一个family参数在通过wp_enqueue_style
输出后被删除了。有没有办法在不使用任何hacky方法的情况下解决这个问题?我认为可能存在一种过时的方法来构建包含两个字体系列的URL,但我宁愿使用Google现在提供的。