How To Manage Common StyleSheets for Multiple WordPress Sites


One of the most frustrating aspects I’ve ever had to deal with when managing a site’s WordPress installation is that annoying Editor area. It’s a place where NOBODY should go. Some problems I’ve had over the many years has been accidentally pasting the wrong code into one of the editor files and losing all the information stored.

Perhaps the most common is the style.css file. I even remember for one of my personal sites going to a Google cached area of my site and grabbing my stylesheet from that to paste back into my style.css due to the massive mistake I had made pasting some other code over the CSS file!

Unfortunately while WordPress manages revision history with both Posts and Pages there is nothing native to manage the revision history of edits made to files in the Editor area. So you’ll either have to hunt for a plugin that could do this, or find ways to manage the files yourself.

One such method that I’ve recently had to employ on a client’s site that has multiple installations of several WordPress installations which predominantly all use the same style guide has been managing the style.css file. While each website has a few little differences, managing each style.css has been a nightmare.

So one of the techniques I have undertaken has been to obtain all the common CSS styles between all sites, place that file to a centralised sub-domain I’ve labelled assets and to then manage the minor CSS styles within each site’s own Editor style.css file.

So, for the client with the multiple WordPress installs, site A would have all its theme’s style.css removed (except for the comments as the theme still needs to think it has a stylesheet) and placed within the global header of the site an external stylesheet link to that common file, for example:

<link rel="stylesheet" type="text/css" href="//assets.clientsdomain.com/css/main.css">

Then, within site A’s style.css would be any site specific information, such as links to background images (etc). Site B would then have the same external link in their global header (etc).

It certainly has helped manage not only being able to control the complexity of each site’s differences, but has also helped make global changes should they need to for all sites.

If you’re looking to manage multiple WordPress installations you certainly may want to look at using a technique like this to manage your site’s front-end assets.

Recent Posts