WordPress.org

Ready to get started?Download WordPress

Forums

wp-forecast
[resolved] Weather for a specific date (9 posts)

  1. KingShinobi
    Member
    Posted 1 year ago #

    Hi,

    can your plugin be modified to only show the weather forecast for a specific date/weekend, as soon as there are some informations available?

    http://wordpress.org/extend/plugins/wp-forecast/

  2. tuxlog
    Member
    Plugin Author

    Posted 1 year ago #

    No, the plugin won't do that. But it should be easy to achieve if you use wp-forecast via sidebar.php because you know how many days of forecast the weather provider delivers and you should know which date you want.

    Saying you have accuweather with nine days of forecast. Today is the 2013-01-25 and you want to see the 2013-01-30.

    Then you have to build something like this

    $daydiff=(strtotime('2013-01-30') - strtotime('2013-01-25'))/86400
    If ($daydif <= 9) {
    wp_forecast('A');
    } else {
    echo "No weather data yet";
    }

    It calculates the differenz between the to dates and if it is lesser than the days of forecast available it shows the widget else showing no weather data yet

  3. KingShinobi
    Member
    Posted 1 year ago #

    ok that sounds good, but it still display todays forecast instead the one from 2013-01-30 although it should already be available.

  4. KingShinobi
    Member
    Posted 1 year ago #

    ok if i activate all days, it displays me all weather infos up until the desired date, but I only want to show the specific day.

    i guess i have to pass wp_forecast('A') some parameters to only display the forecast with the correct date, but I don't know how to filter that.

  5. tuxlog
    Member
    Plugin Author

    Posted 1 year ago #

    Ah, no I see what you want to achieve.
    Well, this is not a feature at the moment. You can't select only one day. But maybe I have a workaround for you:

    Create nine widgets, widget A shows day 1, widget B shows day 2, ....
    Then you can calculate which widget is to use to show the day you want.

    An example:
    calculate how many days apart from today you wanted day is.
    use the widget corresponding to this day, e.g. widget D for day 4

    This may work.

  6. KingShinobi
    Member
    Posted 1 year ago #

    hi,

    thanks for the reply. Your idea could be managable, but maybe there is another solution.

    How are the nine days forecast displayed? Is it a loop that repeats up to nine times? If yes, then I could try to hook into the loop and just look for the date of each day and if it the correct one, display it. All other days should just not be displayed. For that I would need to know, if the date is stored in a variable, whats the name of it and where I can find it. I hope you can help me a little with that and maybe implement it into your plugin at some point. I will be happy to give you my solution if I get it to work.

  7. tuxlog
    Member
    Plugin Author

    Posted 1 year ago #

    You can find all the code to display the weather in wp-forecast-show.php
    Look for "output forecast" around line 350. There is a loop with variable $i which prints the forecast You can get the date with $w['fc_obsdate_'.$i].

    I am not sure about integrating this interesting but exotic feature but will think about it.

  8. KingShinobi
    Member
    Posted 1 year ago #

    alright, i will do my best and keep you updated. i'm surprised to nobody seems to need such a feature. for an event organisator thats a great feature to show the weather for the upcoming event.

  9. mischkaffee
    Member
    Posted 1 year ago #

    I just registered to ask if you could add this feature. It would be very useful, especially if it could serve as a guide to attendees before the event, and as a record of the day's weather after the event.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.