【问题标题】:wordpress child theme styles.css does not want to override parent style.csswordpress子主题styles.css不想覆盖父style.css
【发布时间】:2014-07-08 13:29:08
【问题描述】:

我的子主题 styles.css 不想覆盖父主题 style.css.

我正在与wordpress theme twenty fourteen 合作。

我创建了一个子主题,通过研究发现了下面这段代码...

require_once( get_stylesheet_directory() . '/my_included_file.php' );

我的问题是这段代码到底去哪儿了?我读过functions.php。所以我把它放在页面的第一行。 我希望我的子主题样式表优先于我的父样式表。

谢谢你的帮助会很棒..

【问题讨论】:

    标签: css wordpress themes


    【解决方案1】:

    您应该不需要该代码。激活子主题后,该样式表将包含在父主题之后,因此将覆盖父主题样式表中的样式表。

    阅读更多关于Child Themes at the WordPress Codex的信息。

    【讨论】:

      【解决方案2】:

      您可以直接在子主题style.css 中通过@import url('../parent-theme-name/style.css'); 导入父主题style.css,并在其下方编写您自己的css 代码或覆盖父主题css 代码。

      你也可以使用这个插件来创建子主题http://wordpress.org/plugins/orbisius-child-theme-creator/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-02-28
        • 2013-11-10
        • 1970-01-01
        • 2019-10-13
        • 1970-01-01
        • 2013-07-13
        • 2017-02-19
        • 2015-07-27
        相关资源
        最近更新 更多