Guest User

Untitled

a guest
May 27th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. <?php
  2. /**
  3. * Create your custom stylesheets based on the taxonomy tid in
  4. * $theme_dir/css/taxonomy/$tid.css
  5. */
  6. function THEME_preprocess_node(&$vars, $hook) {
  7. if ($terms = taxonomy_node_get_terms($vars->['node'])) {
  8. foreach ($terms as $term) {
  9. $stylesheet = '/css/taxonomy/'. $term->tid .'.css';
  10. if (file_exists(dirname(__FILE__) . $stylesheet)) {
  11. drupal_add_css(path_to_theme() . $stylesheet);
  12. }
  13. }
  14. }
  15. }
Add Comment
Please, Sign In to add comment