Skip to content

Instantly share code, notes, and snippets.

@ddnode
Created May 10, 2013 09:51
Show Gist options
  • Save ddnode/5553502 to your computer and use it in GitHub Desktop.
Save ddnode/5553502 to your computer and use it in GitHub Desktop.
Drupal根据星期切换主题
<?php
/**
* Implements hook_custom_theme().
*/
function mysite_custom_theme() {
// An array of themes for each day of the week.
// These themes have to be installed and enabled.
$themes = array();
$themes[0] = 'garland';
$themes[1] = 'bartik';
$themes[2] = 'stark';
$themes[3] = 'seven';
$themes[4] = 'mytheme';
$themes[5] = 'sky';
$themes[6] = 'danland';
// Get the current day of the week in numerical form.
$day = date("w");
// Override current theme based on day of the week.
return $themes[$day];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment