首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WordPress子主题错误

WordPress子主题错误
EN

Stack Overflow用户
提问于 2015-12-16 10:16:03
回答 1查看 185关注 0票数 0

嗨,我用的是WordPress的WooThemes主题。我正在使用店面主题,并试图添加我自己的子主题(css文件),但它将不能正常工作。

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

代码语言:javascript
复制
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文件中添加了我认为是正确的语法。

代码语言:javascript
复制
/*
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");

当我在浏览器中检查它时,它显示在头部的最顶端,但不正确,浏览器似乎找不到它。我还发现奇怪的是,当它的上一次被加载时,它会在头部的顶部加载。我表现得..。

代码语言:javascript
复制
<link rel="stylesheet" type="/custom-child.css" href="mystyle.css">

正如您所看到的,这是完全错误的,href指向'mystyle‘,我不知道它是从哪里来的,并且类型显示了我的文件名。

如果有任何机构在这方面有任何经验,并且愿意提供帮助,那就太好了。谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-12-16 10:37:52

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

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34309256

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档