How to change my homepage based on the time of day? I have searched high and low for this. How do I change my homepage based on the time of day? To be absolutely explicit, I want:


Between 8am and 7pm - Homepage 1 (node/4)
Between 7pm and 8am - Homepage 2 (node/5)


So I want to design two completely different homepages and then they change based on time of day.

I tried some code but it doesn't seem to do the job:

$current_front = variable_get('site_frontpage');

if($current_front== 'node/4'){
    variable_set('site_frontpage','node/5');
}else{
    variable_set('site_frontpage','node/4');
}


Note:  I am not a code whizz so wouldn't know where to start with hooks and I'm a million years away from creating my own modules.
Consider using the Rules module to set the appropriate node as your frontpage.

Based on the sample in the question, I'm assuming that node/4 is what the value is of site_frontpage. Here is the actual rule to be created that could work in your case:


Create a new rule
Event = Content is viewed
Condition: data comparison -> node:nid equals 4
Add an extra condition to check if current time is between 7pm and 8am.
Action: page redirect to node/5


For anybody not familiar (enough/yet) with Rules, checkout the 32 (!!!) great (+ free) video tutorials Learn the Rules framework. Possibly also the similar set of 8 video tutorials about the Flag module, often considered as a natural complement to the Rules module. Maybe also review the set of 30 video tutorials about the Views module ... Familiarity with only those 3 modules (Views, Rules and Flag) can get you pretty far in mostly any Drupal site (as a site builder).