views:

62

answers:

2

What if you have a CSS template that's really nice, and you want to use it with a wordpress theme, but don't want to edit all the theme files to use the rules in the CSS template? Is there a way to create a CSS file that acts as a proxy between the new CSS template and old WP theme?

+1  A: 

Good question! I'm afraid I think there is no native way. There would have to be a syntax like

propertyname: inherit-from(.classname);     // Fictitious example! Does not work

which doesn't exist in CSS proper.

It could probably be done, though, using a CSS pre-compiler like LeSS. LeSS's "Mixins" function looks like it might do exactly what you need. From their front page:

.rounded_corners (@radius: 5px) { 
  -moz-border-radius: @radius;
  -webkit-border-radius: @radius;
  border-radius: @radius;
}

#header {  
  .rounded_corners;  
}

where rounded_corners would be your original class definition, and #header the WordPress equivalent.

Pekka
+1  A: 

Child themes! - themeshaper.com/functions-php-wordpress-child-themes

TheDeadMedic
Seriously. If you have the stylesheet and basic layout already in html/css, you should just be using a child theme. It's way easier, is natively supported by WordPress, and doesn't involve spurious hacks and work-arounds.
John P Bloch