Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment