Changing Header Logo based on Date/Time

Hey Gurus -

Any hints on how I might swap my main header logo out based on the user’s date and time?

I don’t want to overcomplicate things, but I thought it might be a nice touch to chance the sun to a moon, etc. (



This should work or be close. It is not tested.

What it does is looks at the current hour of the day and determines if it’s day or night (am or pm) and then copies a designated file to the filename configured for your Customer Logo.

Reminder, this is untested…


if( !defined('AREA') ) die('Access denied');

define('night_start', 19); // 7pm
define('night_end', 6); // 6am
define('my_day_image', 'images/my_daytime_logo.jpg'); // path to daytime image
define('my_night_image', 'images/my_nighttime_logo.jpg'); // path to nighttime image
define('my_logo_file', Registry::get('manifest.Customer_logo.filename')); // Configured logo for customer pages

// return what range (am or pm) of current hour at customer's location
function my_logo_time() {
$hr = date('G', TIME);
return ($hr >= my_night_start && $hr < night_end) ? 'pm', 'am');

$cur_setting = Registry::get('cur_logo_setting');
$setting = my_logo_time();
if( $cur_setting != $setting ) {
switch($setting) {
'am': fn_copy(my_day_image, my_logo_file);
Registry::set('cur_logo_setting', $setting);
'pm': fn_copy(my_night_image, my_logo_file);
Registry::set('cur_logo_setting', $setting);


Thanks so much - I will give it a go!!