I was using the same template for 2 different websites and had to customize some CSS only on 1 site. I still wanted to keep only 1 template version.
I edited the template body classes using the wordpress body_class function.
Before the changes the body html tag looked like this:
<body <?php body_class(); ?>>
and after changes:
<?php global $blog_id; ?>
<body <?php body_class('site'.$blog_id); ?>>
Then in my CSS I can for instance use ‘site2’ as a class to only apply CSS to blog 2.
body.site2 a { color: #AAA; }
This customization can also be done using theme options or from the database, but as a developer I find it easier and better to edit CSS files directly.
No Comments Yet