gpt4 book ai didi

css - WordPress子主题错误

转载 作者:行者123 更新时间:2023-11-28 06:40:39 27 4
gpt4 key购买 nike

您好,我正在使用 WooThemes 的 WordPress 主题。我正在使用店面主题并尝试添加我自己的子主题(css 文件),但它无法正常工作。

我已将它添加到我的 setup.php 函数文件中

function storefront_child_scripts() {
if ( is_child_theme() ) {
wp_enqueue_style( 'storefront-child-style', get_stylesheet_uri().'/custom-child.css', array('parent-style'), '1.0.0' , 'all' );
}
}

我还在 css 文件中添加了我认为正确的语法..

/*
Theme Name: Storefront
Theme URI: http://www.woothemes.com/storefront
Author: WooThemes
Author URI: http://www.woothemes.com
Description: Storefront is the perfect theme for your next WooCommerce project. Designed and developed by WooThemes, it features a deep integration with our market leading WooCommerce plugin, several layout & color options to personalise your shop, multiple widget regions, a responsive design and much more. Developers will love it's lean and extensible codebase making it a joy to customise and extend. Looking for a WooCommerce theme? Look no further!
Version: 1.5.3
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: storefront
Tags: black, white, light, two-columns, left-sidebar, right-sidebar, responsive-layout, custom-background, custom-colors, custom-header, custom-menu, featured-images, full-width-template, threaded-comments, accessibility-ready, rtl-language-support
*/

@import url("../storefront/style.css");

当我在我的浏览器中检查它时,它显示在头顶但不正确,浏览器似乎无法找到它。我也觉得很奇怪,当它最后加载时它加载在头顶。我显示为...

<link rel="stylesheet" type="/custom-child.css" href="mystyle.css">

如您所见,这是完全错误的,href 指向“mystyle”,我不知道它来自哪里,类型显示我的文件名。

如果有人对此有任何经验并愿意提供帮助,那就太好了。谢谢

最佳答案

您始终可以安装一个名为自定义 css 的插件,它会覆盖主 css 文件。在那种情况下,您甚至可以在后端自定义 css 而无需使用 ftp。

我通常不会推荐这个,因为这会使子主题变得毫无用处,除非您编写自己的函数。

关于css - WordPress子主题错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34309256/

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