0

I built a site with the theme Corporate Clean. I wanted to add some custom CSS (override some colors, fonts etc.) so I added this to the files in the folder /sites/all/themes/corporateclean/...). Now an update for the theme became available and I lost all my custom styles (I have them in source control so no panic).

What is the best way to add custom css that doesn't disappear when a new theme version is published? I prefer file based. I've seen CSS Injector but that CSS would also be gone if I start from a new database.

1 Answer 1

2

What you want to do is create a sub-theme so that updating your contributed theme does not overwrite custom changes you've made.

4
  • Thanks, this works very well. However they have a slideshow banner in the template that is visible on the home page. If I want to adapt that they instruct me to edit the template. I know that my sub theme can override the whole page.tpl.php file but is there clean a way to only override the banner section and get the updates for the rest of the template? The banner is not a block btw...
    – Koen
    Jun 1, 2012 at 18:09
  • What kind of slideshow is it? If you use something like Views Slideshow or Views Galleriffic you shouldn't need to touch the page template.
    – acouch
    Jun 4, 2012 at 21:11
  • It is built in the template, check out the demo page: demo.drupalizing.com/?theme=corporateclean
    – Koen
    Jun 5, 2012 at 9:00
  • Generally you would never ever put content like that directly into a template like this theme does: drupalcode.org/project/corporateclean.git/blob/refs/heads/… In this case since they have done that you are forced to overwrite the entire template file. You could save yourself the trouble next time by adding this content as a variables using: api.drupal.org/api/drupal/includes%21theme.inc/function/… but you would still need to cut and paste into their page.tpl.php
    – acouch
    Jun 5, 2012 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.