• Resolved LS

    (@lsterling03)


    In addition to showing the current weather, I want to show today’s forecast. When I checked to show the 16 day forecast, and selected “1 day”, it starts with tomorrow. (I double checked my wordpress timezone settings to make sure it was correct.) No matter what combination of settings I try, the first day of the forecast is always tomorrow. How do I show TODAY’s forecast? All I want to do is show today’s high/low temperatures. I tried looking through the plugin code but I can’t find the function that displays today’s forecast. I’m working with the custom template.

    Thank you.

    https://wordpress.org/plugins/wp-cloudy/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter LS

    (@lsterling03)

    Ok, so I found this in the plugin code:

    $forecast_temp_min_[$i]   	= (round($myweather_sevendays->forecast[0]->time[$i]->temperature[0]['min']));
    $forecast_temp_max_[$i]   	= (round($myweather_sevendays->forecast[0]->time[$i]->temperature[0]['max']));

    So to get today’s temps, I tried that code with time[0]:

    Min Temp = <?php echo (round($myweather_sevendays->forecast[0]->time[0]->temperature[0]['min'])); ?>
    Max Temp = <?php echo (round($myweather_sevendays->forecast[0]->time[0]->temperature[0]['max'])); ?

    That code does return min and max temps, but the temps aren’t correct and don’t match the forecast for today on openweathermap.org’s forecast page. If I use time[1] or time[2] etc… it DOES display temps that match those on openweathermap.org’s forecast page for tomorrow and the day after. So it would make sense that time[0] should be today’s data. Do you know why the returned temps aren’t correct? Or, do you know how I can modify that code so that it IS correct?

    Thread Starter LS

    (@lsterling03)

    More information….

    I think the above problem was a caching issue, as it now matches the openweathermap.org website’s forecast. Still, I think it should be easier to show today’s forecast without having to use custom code. It would be helpful if you just made the 16-day forecast begin with today.

    But another issue I’m now seeing…

    The current weather icon shows a sun, and it’s dark outside right now so it should be a moon. The forecast on openweathermap.org correctly shows a moon. I tried turning caching off and that didn’t affect it.

    The last updated date says todays date at 11:59pm. But 11:59pm hasn’t happened yet. It’s only 7:15pm right now as I write this. My WordPress timezone settings are correct, but it doesn’t appear to be using the WP timezone for the last updated date. Perhaps that’s also causing the problem with the sun/moon symbol?

    These issues are happening on the default no-skin template with no customizations.

    Plugin Author Benjamin Denis

    (@rainbowgeek)

    Hi,
    WP Cloudy doesn’t manage Moon for the moment but it’s in the to-do-list.
    For current weather forecast, I don’t understand what you want.
    By default, WP Cloudy can show current weather and hourly forecast…

    To set cache time, go to WP Admin > Settings > WP Cloudy > Advanced tab.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to display today's forecast?’ is closed to new replies.