Created
June 20, 2012 15:30
-
-
Save mynameispj/2960503 to your computer and use it in GitHub Desktop.
Drupal 7: add CSS files to certain nodes in template.php
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
function pj_preprocess_page(&$variables, $hook) { | |
//ADD TESTICULAR CANCER CSS TO FRONT PAGE | |
if (drupal_is_front_page()) { | |
drupal_add_css(drupal_get_path('theme', 'pj') . '/css/tc.css', array('group' => CSS_THEME, 'type' => 'file')); | |
} | |
// When this goes through the theme.inc some where it changes _ to - so the tpl name is actually page--type-typename.tpl | |
if (isset($variables['node'])) { | |
$variables['theme_hook_suggestions'][] = 'page__type__'. str_replace('_', '--', $variables['node']->type); | |
//ADD TESTICULAR CANCER CSS TO BLOG POST | |
if ($variables['node']->nid == 24) { | |
drupal_add_css(drupal_get_path('theme', 'pj') . '/css/tc.css', array('group' => CSS_THEME, 'type' => 'file')); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment