Skip to content

Instantly share code, notes, and snippets.

@halgatewood
Created March 23, 2018 15:52
Show Gist options
  • Save halgatewood/a0a1dab73f230b5c6496334c60db2ad1 to your computer and use it in GitHub Desktop.
Save halgatewood/a0a1dab73f230b5c6496334c60db2ad1 to your computer and use it in GitHub Desktop.
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