简体   繁体   中英

Troubles modifying WordPress Roots theme

I was told that if I would use Roots theme for wordpress, it would save me time and nerves if I develop wordpress sites. However, I'm unable to do any modifications on the theme, the style.css is not included on the site, and even if I include it after the other stylesheets, it wont do anything, as I've tried maybe the simplest thing ever:

h1{display:none;}

I've also tried reading the docs at https://github.com/retlehs/roots/blob/master/doc/README.md and bootstrap documentation http://twitter.github.com/bootstrap/index.html but I'm still unable to do any modifications. I don't dare to modify the bootstrap.css itself, so how I'm supposed to modify this?

You can add any css style you want but you have to add it in the assets/css/app.css file located in the theme's folder.

You were right about not modifying bootstrap.css or any other core files. Just modify:

  1. for your css styles additions you edit the assets/css/app.css
  2. for your .js custom additions you edit the assets/js/main.js and you put any javascript plugin inside assets/js/plugins.js
  3. for your .php custom additions to the theme (like php functions) you edit lib/custom.php (Or you can also create new files and include theme)

This way you can correctly update the theme.

If it still doesn't get applied the reason could be css specificity.

Here's some more information: http://www.w3.org/TR/selectors/#specificity

As a final resort you can use:
h1{display:none !important;}

Use this temporary until you find a better solution.

You really shouldn't use !important unless you really have no other choice (and that should be rare). The reason that your custom styles don't get applied is that the CSS "specificity" is dictating that other rules are more relevant/important than your custom one. Make your custom CSS rule more "important" than Bootstrap's and your style will show up.

Here's some more information: http://www.w3.org/TR/selectors/#specificity

EDIT: This was meant as a reply to the last post in the other thread, but I have no idea how to reply to that one. I'm new! Apologies!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM