css - 我的 wordpress 子主题使用父母的主题字体系列,无论我在我的子主题 css 中选择什么字体
问题描述
我尝试在我的子主题中应用不同的字体系列,但主题使用父主题的字体。其他 css 属性工作正常。我只有 font-family 属性才有这个问题。它仅在我使用 !important 时有效。任何帮助深表感谢。
子主题的 function.php 文件:
<?php
add_action( 'wp_enqueue_scripts', 'load_theme_assets' );
function load_theme_assets() {
$parent_style = 'parent-style';
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
# Loading Child Theme Main Stylesheet
wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css');
# Loading AOS Stylesheet
wp_enqueue_style( 'aos', get_stylesheet_directory_uri() . '/assets/css/aos.css');
# Loading Owl Carousel Stylesheet
wp_enqueue_style( 'owl-carousel', get_stylesheet_directory_uri() . '/assets/css/owl.carousel.css');
# Loading Owl Carousel Theme Default Stylesheet
wp_enqueue_style( 'owl-theme-default', get_stylesheet_directory_uri() . '/assets/css/owl.theme.default.css');
# Loading Google Fonts
wp_enqueue_style( 'custom-google-fonts', 'https://fonts.googleapis.com/css?family=Lora|Martel|Noto+Serif+SC|Playfair+Display&display=swap', false);
# Loading Font Awesome Icons
wp_enqueue_style( 'all', get_stylesheet_directory_uri() . '/assets/css/all.css');
还有我的 CSS 文件:
body {
border: 1px solid #999;
background-color: #F9F8F8;
font-family: 'Martel', serif;
}
所以,我可以看到边框和背景发生了变化,但字体保持不变。
解决方案
推荐阅读
- android - 网络浏览器:检测禁用的应用链接
- cassandra - 如何检查客户端读/写数据从/到哪个 Cassandra 节点?
- c++ - char a[n][m] 和 char a[][m] 之间有区别吗?
- python - Sage中两个方程组的真实解
- javascript - 你如何在一个 JavaScript 项目中使用多个不会用作 Web 应用程序的文件?需要一个工作示例
- javascript - Discord.js 编写和编辑 json 文件
- javascript - Vue Router 似乎不喜欢函数调用
- pip - pip install 命令中的问题
- flutter - Flutter:我可以调用同一个 Future,首先使用“then()”,然后是“await”,而不会引发竞争条件问题吗?
- gitlab - 在 podman 实例上重新启动 Gitlab 时已存在瞬态时间服务