首页 文章

无法在wordpress主题上编辑css样式表

提问于
浏览
0

我无法在wordpress主题上获得简单的CSS更改

我通过浏览器同步将gulp.js处理的SASS处理到我的主题文件夹的根目录中的style.css文件中 .

h1 {
    font-size: 3em;
    color: green;
}

h2 {
    font-size: 2.6em;
    color: blue;
}

在我的wordpress主题上,我在页面上填充了H1和H2标签

enter image description here

WP-content文件夹结构在PHPstorm上看起来像这样

enter image description here

我在wordpress管理员下选择了主题,我是不是在某个方面没有在我的主题中引用我的style.css文件?或者可能需要在index.php / index.html中指定它?

EDIT

它现在工作正常,我第一次排队样式是正确的,不知道为什么它不能提前工作

enter image description here

3 回答

  • 1

    您不需要在head中添加样式表,默认的style.css应该使用下面的函数排列在functions.php中 .

    wp_enqueue_style( 'text-domain-style', get_stylesheet_uri() );

    如果这样做的话 . 只需清除缓存或使用隐私浏览,或确保下面没有任何样式覆盖您的样式更新 . (css层次结构)

  • 1

    我相信你需要在header.php文件中包含样式表 .

    见:How to include styles.css in wordpress theme?

  • 1

    您可以将它放在编辑器中的style.css文件中,方法是将它放在相同的主题css区域中,例如,位置为E:\ XAMPP \ htdocs \ project-example \ wp-content \ themes \ twentysixteen \ css

相关问题