WordPress.org

Ready to get started?Download WordPress

Forums

wp-forecast
[resolved] change weather location for each page (6 posts)

  1. arpitap
    Member
    Posted 3 years ago #

    Hello!

    I am developing hotel brand website and in that they have different hotels in different locations.
    So what I want to do is when people open one hotel it should display weather for that location and when people open other hotel it will display weather for that location.

    In short I want to display different location weather in each page.

    Can anyone suggest me some way for that? I am PHP guy, so I can make changes in code also if it is required.

    Any help would be appreciated.

    Thanks in advance,
    Arpita

  2. arpitap
    Member
    Posted 3 years ago #

    I have given some condition in func_accu.php, but it is not taking that conditioning unless I update the backend for wp-forecast.

  3. tuxlog
    Member
    Plugin Author

    Posted 3 years ago #

    Well, I can think about two ways of achieving this. first is to create a selection widget with all locations you want and add a bit javascript to set the correct location for your page. the second and easier variant is to add a bit of php to your sidebar.php where you get the pagename and switch to the correct widget.

    e.g.:
    switch($pagename) {
    case 'page1': $wid='A';break;
    case 'page2' : $wid='B';break;
    ...
    }
    if(function_exists(wp_forecast))
    wp_worecast($wid);
    }

  4. arpitap
    Member
    Posted 3 years ago #

    Thanks tuxlog,

    the problem is that I need to use more than 20 widgets because we have more than 20 hotels in one brand.

    Arpita

  5. tuxlog
    Member
    Plugin Author

    Posted 3 years ago #

    you can raise the number of available widget in wp-forecast.php changing $wpf_maxwidgets (somewhere at the top of the file) to the number you need.
    but please keep in mind that this may lead to a sometimes high server load. but you can control this setting the cache time higher and lower the timeout for the connections. it may be that you have to test various settings until you finde the best for your environment. please also have a look at the license from accuweather or weatherbug to make sure you are in line with those.

    regards, hans

  6. arpitap
    Member
    Posted 3 years ago #

    Thanks Hans for your help.

    I will try that and let you know if it helped.

    Arpita

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic