gpt4 book ai didi

css - 无法将自定义 CSS 文件添加到我在 WordPress 中的 Bootstrap 主题

转载 作者:行者123 更新时间:2023-11-28 12:18:58 24 4
gpt4 key购买 nike

我在我的网站上使用 Twitter Bootstrap 主题和 WordPress。我的问题是我想为我的网站制作一个自定义导航栏菜单,不想使用 Bootstrap 默认菜单。这就是我创建自定义菜单的原因,但现在我的问题是我不知道在哪里添加我的 css 文件。我已将它们添加到 wordpress/wp-content/themes/the-bootstrap/css/ 但我不知道在哪里或如何在 header.php 中调用它们或在 function.php 中。

wordpress/wp-content/themes/the-bootstrap/css 中已经有 2 个 CSS 文件,它们是:

bootstrap.cssbootstrap.min.css

这是我要包含的 4 个 css 文件:

<link rel="stylesheet" href="css/base.css" type="text/css" charset="utf-8">
<link rel="stylesheet" href="css/mac.css" type="text/css" charset="utf-8">
<link rel="stylesheet" href="css/nav.css" type="text/css" charset="utf-8">
<link rel="stylesheet" href="css/productbrowser.css" type="text/css" charset="utf-8">

最佳答案

如果您想在 header.php 中调用它们,您需要获取 css 文件的完整 url。您可以使用 get_template_directory_uri() 这样做:

<link rel="stylesheet" href="<?php get_template_directory_uri();?>/css/base.css" type="text/css" charset="utf-8">
<link rel="stylesheet" href="<?php get_template_directory_uri();?>/css/mac.css" type="text/css" charset="utf-8">
<link rel="stylesheet" href="<?php get_template_directory_uri();?>/css/nav.css" type="text/css" charset="utf-8">
<link rel="stylesheet" href="<?php get_template_directory_uri();?>/css/productbrowser.css" type="text/css" charset="utf-8">

关于css - 无法将自定义 CSS 文件添加到我在 WordPress 中的 Bootstrap 主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17080586/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com