Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I'm running a site that uses a separate admin theme. I'd like to include a couple additional pages that use the admin stylesheets. How can I apply the theme selectively to these pages. I'd rather do this in hook_init() or template.php. I don't want to add any more contrib modules to the site at this point. Thanks for any illumination.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

The Administration theme module will do it, but given you'd like to do it yourself, it does cast some light on that path by suggesting the hook_admin_theme_check() and hook_admin_theme_info() hooks.

share|improve this answer
    
I did enable the Administration theme module which worked nicely - thanks. –  starsinmypockets Dec 30 '11 at 15:14
add comment

You can use the module Administration theme for that but if you just want to use the admin theme for a single path you can define it in hook_init

/*
 * Implements hook_init().
 * Use the admin theme on path 'batch'
 */
function MODULENAME_init() {
  if (arg(0) == 'batch') {
    global $custom_theme;
    $admin_theme = variable_get('admin_theme', 'garland');
    init_theme();
  }
}
share|improve this answer
add comment

Your Answer

 
discard

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.