GetSimple Support Forum
How do I change themes depending on time of day or day of year - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: How do I change themes depending on time of day or day of year (/showthread.php?tid=2466)



How do I change themes depending on time of day or day of year - Stompor - 2011-12-06

Is there a way to make GetSimple choose the theme based on the time of day, or the day of the year?

I would like to have a theme for Daytime and on for Night, and I also would like a special theme certain holidays. ie
Christmas, Newyears, etc.

Thanks for the help.


How do I change themes depending on time of day or day of year - mvlcek - 2011-12-06

Stompor Wrote:Is there a way to make GetSimple choose the theme based on the time of day, or the day of the year?

I would like to have a theme for Daytime and on for Night, and I also would like a special theme certain holidays. ie
Christmas, Newyears, etc.

Thanks for the help.

Create a php file like the following (a plugin) and put it in your plugins folder:
Code:
<?php
# get correct id for plugin
$thisfile = basename(__FILE__, ".php");

# register plugin
register_plugin(
  $thisfile,
  'Day/Night Theme Switcher',  
  '0.1',    
  'My Name',
  'http://my.home.page',
  'Switch theme based on time',
  '',
  ''  
);

# activate filter
add_action('index-pretemplate','theme_switcher_process');

function theme_switcher_process() {
  global $TEMPLATE;
  # TODO determine time
  ...
  $hour = ...;
  if ($hour >= 8 && $hour < 18) {
    $TEMPLATE = 'Cardinal'; # use your theme name
  } else {
    $TEMPLATE = 'Innovation'; # use your theme name
  }
}



How do I change themes depending on time of day or day of year - Stompor - 2011-12-07

WOW!!!!
Thanks for the help and quick response.