Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Creating weather background images based on day and night using the 24 hour clock. Requires new images for the night time.
function hg_awesome_weather_bg_ext()
{
// 24 HOUR CLOCK:
// LESS THAN 8 AM OR GREATER THAN 9 PM
if( get_the_time('G') < 8 || get_the_time('21') > 9 )
{
return "night.jpg";
}
return "jpg";
}
add_filter('awesome_weather_bg_ext', 'hg_awesome_weather_bg_ext');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment