I've installed the Roots theme (version 4 so I can use the 1140px Grid) on Wordpress 3.3.1, and want to edit the CSS. Initially I only get the style.css file in the editor and can't see the others.

The css files I need are located in a subfolder marked 'css', and I see from a quick Google search that there is a known bug with css subfolders, so I moved them into the root folder which seems to be working, but the site now looks a bit wonky, so I don't think it's quite right.

How do I ensure that the css files are placed in the right order in the Wordpress code? At the moment I don't know how to find out which order they have been set in.

2 Answers
2

1. Don't edit your theme using the WordPress editor.

This is a quick-and-dirty approach to development, but you can easily destroy your entire site by mistake with this tool. Instead, edit the files on your machine locally and then use FTP to upload the changed files to the server.

2. Moving the CSS will break the theme.

WordPress requires that themes register their CSS in order to render it to the page. Themes use a function (wp_register_style()) to tell WordPress the name of the stylesheet, its location, and to specify whether or not other stylesheets need to be loaded first.

Roots includes some of these definitions in /inc/roots-scripts.php. Two lines, for a specific example:

A few notes I have observed about how Roots loads CSS. It loads the files in this order:

css/style.css

css/bootstrap.css

css/bootstrap-responsive.css (optionally, if BOOTSTRAP_RESPONSIVE is set to true in inc/roots-config.php)

css/app.css

These are my preliminary observations, but it's clear that you want to edit the CSS files in Roots in a nicely structured way.

css/style.css I think this is mostly the HTML5 Boilerplate stuff, maybe some other setup stuff? You probably wouldn't want to touch this.

css/bootstrap.css, and css/bootstrap-responsive.css Note here, that these files come from Twitter Bootstrap, and are compiled by pointing a LESS compiler at css/less/bootstrap.less and css/less/bootstrap-responsive.less. You might never need to change these files. If you did, it would be far nicer to study up a bit on LESS, make changes in the .less files, and recompile them. There are mostly just a handful of @variables that you would want to change, and if you do it this way, according to the way Bootstrap is set up to work, you will have a very nice, organized process. The main things you'd change here are layout options and color settings. (There are a number of free LESS apps you can download to recompile the files.)

css/app.css This is a very nicely structured standard CSS file, with sections for Base, Header, Content, etc. Here, you'd just want to try to keep your CSS nicely organized into the sections provided.

I am finding that if I approach it in an orderly way, and understand how Roots is structuring things, it is really a very nice system.

Thanks Chris. I'm using an older version of Roots so that I can use the 1140 Grid System framework instead of Twitter Boilerplate. They removed it from the latest version and just stuck to one framework for simplicity. I guess the order will be similar or equivalent for 1140 css files. Although looking at style.css, this seems to just contain template info only, no actual css.
–
user15152Apr 13 '12 at 10:15