Created
June 2, 2010 02:18
-
-
Save malclocke/421827 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Create your custom stylesheets based on the taxonomy tid in | |
* $theme_dir/css/taxonomy/$tid.css | |
*/ | |
function THEME_preprocess_node(&$vars, $hook) { | |
if ($terms = taxonomy_node_get_terms($vars->['node'])) { | |
foreach ($terms as $term) { | |
$stylesheet = '/css/taxonomy/'. $term->tid .'.css'; | |
if (file_exists(dirname(__FILE__) . $stylesheet)) { | |
drupal_add_css(path_to_theme() . $stylesheet); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment