Skip to content

Instantly share code, notes, and snippets.

@halgatewood
Created June 28, 2016 17:45
Show Gist options
  • Select an option

  • Save halgatewood/d03e6577f794b93777a5a46577d9b448 to your computer and use it in GitHub Desktop.

Select an option

Save halgatewood/d03e6577f794b93777a5a46577d9b448 to your computer and use it in GitHub Desktop.
Get the weather and time of day to display custom images, videos, etc with the Awesome Weather Widget
<?php
// OPENWEATHERMAPS:
$weather_name = awesome_weather_preset_condition_names_openweathermaps( $weather->data['current']['condition_code']);
// YAHOO
$weather_name = awesome_weather_preset_condition_names_yahoo( $weather->data['current']['condition_code']);
$current_time = get_the_time('H');
$tm = ( $current_time < 6 AND $current_time > 9 ) ? "night" : "day";
// GET THE FILE
$filename = $weather_name . "-" . $tm . ".mp4";
// $filename would be like: cloudy-day.mp4, sunny-night.mp4, windy-day.mp4, etc
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment