Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using jquery tabs on my page but they loaded some default styles that I didn't want. Thus I removed them with the following code:

drupal_add_library('system', 'ui.tabs');

function mytheme_css_alter(&$css) {
   // List of disabled drupal default css files.
   $disabled_drupal_css = array(
      // Remove jquery.ui css files.
      //  'misc/ui/jquery.ui.tabs.css',

  // Remove drupal default css files.
     foreach ($css as $key => $item) {
         if (in_array($key, $disabled_drupal_css)) {
            // Remove css and its altered version that can be added by jquery_update.

This seems to do the trick, but I also noticed that my backend is not loading it's styles properly. I guess some of it uses the jquery.ui styles.

How can I load these only for the logged in user but not for

share|improve this question
r u writing this in module or theme? – monymirza Mar 5 '13 at 8:24
In theme, in template.php. – Johan Dahl Mar 5 '13 at 8:25

i guess you use the your theme also as admin theme. just use seven as admin theme, and this hook will not be considered.

otherwise you have to check in the hook if your on an admin page, like

if (path_is_admin(current_path())) {}
share|improve this answer

I would use user_is_anonymous() function like this:

function yourtheme_css_alter(&$css) { 
  if(user_is_anonymous()) {
    $exclude = array(
      'misc/ui/jquery.ui.core.css' => FALSE,
      'misc/ui/jquery.ui.theme.css' => FALSE,
    $css = array_diff_key($css, $exclude);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.