A drupal 7 based website has a custom home page. Presently, the whole drupal website has one css called
style.css
. I have written a new css just for home page. Being new to drupal, I have no idea how to specify to home page to use custom css. How to use <link rel....>
kind of thing?
Thanks
Not sure why you would want to do this rather than just using different classes but if you really need to you can add a template.php
file to your theme. In there use the hook_preprocess_page
to add a new stylesheet depending on the homepage. Change YOUR_THEME
to your themes name.
function YOUR_THEME_preprocess_page(&$variables) {
$homepage_id = YOUR HOMEPAGE NODE ID;
if (isset($variables['node'])) {
if ($variables['node']->nid == $homepage_id){
drupal_add_css(path_to_theme() . '/css/homepage.css');
}
}
}