Skip to content

Instantly share code, notes, and snippets.

@sadanandkenganal
Created June 20, 2014 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sadanandkenganal/97924e8b4aa59ebad757 to your computer and use it in GitHub Desktop.
Save sadanandkenganal/97924e8b4aa59ebad757 to your computer and use it in GitHub Desktop.
Add Javascript OR CSS to Particular Content Type Page.

You should add this code in template.php file inside your custom or contributed theme.

function tb_rave_preprocess_node(&$variables) {
    if($node->type == 'contenttypename') {
      $node = $variables['node'];
      drupal_add_library('system', 'ui.tabs');
      drupal_add_css(drupal_get_path('theme', 'yourtheme') . '/example.css');
      drupal_add_css(drupal_get_path('theme', 'yourtheme') . '/example.js');
    }   
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment