Answers.Body: <p>This is the correct way to disable civicrm.css on the front end. Put this in the template.php file of your theme:</p>
  
  <p>function shriver_css_alter(&amp;$css) {
      unset($css['sites/all/modules/civicrm/css/civicrm.css']);
  }</p>
  
  <p>Manually enter the path to the css. When I used drupal_get_path('module','civicrm'), it would output sites/all/modules/civicrm/drupal/css/civicrm.css. Not sure why it added 'drupal' to the path but that was the problem.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-07T13:41:10.213Z
Answers.Text: today I tried removing the civicrm css from the public page by adding function shriver_css_alter(&$css) { unset($css['sites/all/modules/civicrm/css/civicrm.css']); } to the themes template.php. Unfortunately it didn't work. The path to the css is the right one. Did something change during the last years?
Answers.UserDisplayName: Matthias W.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-29T17:02:45.347Z
Answers.Text: Thanks for this, two notes:
  1. This snippet hard-codes the file path location of the civicrm module, your location may be different (e.g. sites/default/modules/civicrm).
  2. This function works equally well in a module (assuming the module's order is after civicrm).
Answers.UserDisplayName: Alan Dixon
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-03T16:17:34.113Z
Answers.LastActivityDate: 2016-11-03T16:17:34.113Z
Answers.UserDisplayName: 3x5
Answers.Body: <p>You can also use the CiviCRM Theme module in Drupal Administration menus: </p>
  
  <p><a href="https://i.sstatic.net/4ac1y.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4ac1y.gif" alt="Drupal Modules Menu"></a></p>
  
  <p>Then, the following menu appears at the bottom of the Drupal Appearance menu:</p>
  
  <p><a href="https://i.sstatic.net/J6YCt.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/J6YCt.gif" alt="Allow different themes to be used for front-facing CiviCRM pages"></a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-06T03:59:05.197Z
Answers.LastActivityDate: 2017-12-06T03:59:05.197Z
Answers.UserDisplayName: Michael Collins
Body: <p>I have the following in my template.php file, in my custom theme:</p>
  
  <pre><code>function shriver_css_alter(&amp;$css) {
      unset($css[drupal_get_path('module','civicrm').'/css/civicrm.css']);
  }
  </code></pre>
  
  <p>It doesn't work, though. I can disable other stylesheets this way, but not this one. I know I can disable this stylesheet in civicrm settings, but then it is disabled on the back end as well. I only want it to be disabled on the public pages. Since I use a different admin theme than my public one, I thought it made sense to disable it for my public theme only.</p>
  
  <p>Can someone help me to get this to work? Or, if you know a different method, that would be good, too. Thank you.</p>
  
Tags: <drupal><css>
Title: How do I disable civicrm.css on public pages in Drupal?
ThreadText: # How do I disable civicrm.css on public pages in Drupal?
  
  (Asked by: username_0 on 2016-11-03)
  
  I have the following in my template.php file, in my custom theme:
  
  ```
  function shriver_css_alter(&$css) {
      unset($css[drupal_get_path('module','civicrm').'/css/civicrm.css']);
  }
  
  ```
  
  It doesn't work, though. I can disable other stylesheets this way, but not this one. I know I can disable this stylesheet in civicrm settings, but then it is disabled on the back end as well. I only want it to be disabled on the public pages. Since I use a different admin theme than my public one, I thought it made sense to disable it for my public theme only.
  
  Can someone help me to get this to work? Or, if you know a different method, that would be good, too. Thank you.
  
  **Tags:** drupal, css
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2016-11-03. Score: 3
  
  This is the correct way to disable civicrm.css on the front end. Put this in the template.php file of your theme:
  
  function shriver\_css\_alter(&$css) {
  unset($css['sites/all/modules/civicrm/css/civicrm.css']);
  }
  
  Manually enter the path to the css. When I used drupal\_get\_path('module','civicrm'), it would output sites/all/modules/civicrm/drupal/css/civicrm.css. Not sure why it added 'drupal' to the path but that was the problem.
  
  > **Comments:**
  > **username_1**: today I tried removing the civicrm css from the public page by adding function shriver_css_alter(&$css) { unset($css['sites/all/modules/civicrm/css/civicrm.css']); } to the themes template.php. Unfortunately it didn't work. The path to the css is the right one. Did something change during the last years?  
  > **username_2**: Thanks for this, two notes: 1. This snippet hard-codes the file path location of the civicrm module, your location may be different (e.g. sites/default/modules/civicrm). 2. This function works equally well in a module (assuming the module's order is after civicrm).  
  
  ---
  
  ### Answer by username_3 on 2017-12-06. Score: 1
  
  You can also use the CiviCRM Theme module in Drupal Administration menus:
  
  [![Drupal Modules Menu](https://i.sstatic.net/4ac1y.gif)](https://i.sstatic.net/4ac1y.gif)
  
  Then, the following menu appears at the bottom of the Drupal Appearance menu:
  
  [![Allow different themes to be used for front-facing CiviCRM pages](https://i.sstatic.net/J6YCt.gif)](https://i.sstatic.net/J6YCt.gif)
  
  
  ---
  
  