WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Weather Forecast – WP Wunderground] Condition is "Fog" but wrong icon

[Plugin: Weather Forecast – WP Wunderground] Condition is "Fog" but wrong icon

  • Hello,
    I really like this plugin and everything was working ok til now – today condition is “Fog” but the icon displayed is “mostlycloudy.gif”
    Here is the today’s source code:

    <td align="center" class="wp_wunderground_fog">
    <img src="http://www.unicath.hr/wp-unicath/wp-content/themes/unicath-hks/images/wundergroundicons/mostlycloudy.gif" width="50" height="50" alt="It is forcast to be Magla at 11:00 PM CEST on September 29, 2012" style="display:block;" />
    <div class="wp_wund_conditions">Magla</div>26°/13°</td>

    As you can see the class is ok: class=”wp_wunderground_fog” but icon is wrong.
    I use my custom icon with this filter:

    add_filter('wp_wunderground_forecast_icon', 'use_custom_wunderground_icons');
    
    function use_custom_wunderground_icons($content=null) { 
    
        $myIconFolder = 'http://www.unicath.hr/wp-unicath/wp-content/themes/unicath-hks/images/wundergroundicons/';
    
        $myFileType = '.gif';
    
        $content = preg_replace('/http\:\/\/icons\-ecast\.wxug\.com\/i\/c\/[a-z]\/(.*?)\.gif/ism', $myIconFolder.'$1'.$myFileType, $content);
    
        return $content;
    }

    I also made a translation to my language, it is in functions.php:

    if (!function_exists('replace_weather')) :
        function replace_weather($content) {
    		$content = str_replace('Chance of Flurries', 'Moguća snježna mećava', $content);
    		$content = str_replace('Chance of Rain', 'Moguća kiša', $content);
    		$content = str_replace('Chance of Freezing Rain', 'Moguća ledena kiša', $content);
    		$content = str_replace('Chance of Sleet', 'Moguća susnježica', $content);
    		$content = str_replace('Chance of Snow', 'Moguć snijeg', $content);
    		$content = str_replace('Chance of Thunderstorms', 'Moguće grmljavinsko nevrijeme', $content);
    		$content = str_replace('Chance of a Thunderstorm', 'Moguća grmljavina', $content);
    		$content = str_replace('Clear', 'Vedro', $content);
    		$content = str_replace('Mostly Cloudy', 'Pretežno oblačno', $content);
    		$content = str_replace('Partly Cloudy', 'Umjereno oblačno', $content);
    		$content = str_replace('Cloudy', 'Oblačno', $content);
    		$content = str_replace('Flurries', 'Snježna mećava', $content);
    		$content = str_replace('Fog', 'Magla', $content);
    		$content = str_replace('Haze', 'Sumaglica', $content);
    		$content = str_replace('Mostly Sunny', 'Pretežito sunčano', $content);
    		$content = str_replace('Partly Sunny', 'Djelomice sunčano', $content);
    		$content = str_replace('Freezing Rain', 'Ledena kiša', $content);
    		$content = str_replace('Rain', 'Kiša', $content);
    		$content = str_replace('Sleet', 'Susnježica', $content);
    		$content = str_replace('Sunny', 'Sunčano', $content);
    		$content = str_replace('Thunderstorms', 'Grmljavinsko nevrijeme', $content);
    		$content = str_replace('Thunderstorm', 'Grmljavina', $content);
    		$content = str_replace('Unknown', 'n/a', $content);
    		$content = str_replace('Overcast', 'Posve oblačno', $content);
    		$content = str_replace('Snow', 'Snijeg', $content);
    		$content = str_replace('Scattered Clouds', 'Mjestimična naoblaka', $content);
    		$content = str_replace('Monday', 'Ponedjeljak', $content);
    		$content = str_replace('Tuesday', 'Utorak', $content);
    		$content = str_replace('Wednesday', 'Srijeda', $content);
    		$content = str_replace('Thursday', 'Četvrtak', $content);
    		$content = str_replace('Friday', 'Petak', $content);
    		$content = str_replace('Saturday', 'Subota', $content);
    		$content = str_replace('Sunday', 'Nedjelja', $content);
    		$content = str_replace('Today', 'Danas', $content);
    		return $content;
    	}
    	add_filter('wp_wunderground_forecast', 'replace_weather');
    	endif;

    And in my icon folder there are all icons I think, including fog.gif and chancerain.gif -two days ago the same situation was with Chance if rain: the condition was “Chance of rain” the class was ok but the icon was mostlycloudy.gif.
    Funny thing is that one day before icon chancerain was displayed ok with the condition.
    Do you have any idea where could it get wrong and why? Did I miss something?
    Thanks

    http://wordpress.org/extend/plugins/wunderground/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Update: today (monday) the chancerain.gif displays ok, with the “chance of rain” forecast cndition.
    BUT there is another issue: this time, for the wednesday the condition is “fog” but the icon used is “partlycloudy.gif”
    I display forecast three days in a row, and sometimes icons are ok sometimes not – I can not see the logic of it.
    Does anyone have any idea how to fix that? Anybody else having the same problem?

    While waiting support to answer I have a thought: could it be , maybe, an issue with order of the “$content = str_replace” in my translation?

    Do I need to put specific translation first in order?
    But since the class is ok (class=”wp_wunderground_fog”) I guess translation is ok too… but why, WHY ?!!!, the wrong icon is displayed?

    Makes me crazy cause I saw those icons already been displayed ok, when they should, and now this – no logic at all… any help?

    Anyone?

    chachalady
    Member

    @chachalady

    It seems no one will answer this – I did not marked this topic as resolved (since it isn’t … I still don’t know what went wrong back then ..now it is ok although I didn’t do anything at all…).

    FOR MODERATORS: ( if you are reading this) you can delete this topic if you think it has been to long without answer.
    Thanks.

    Jeff
    Participant

    @jtf1117

    chachalady – just wanted to let you know someone is reading your post 🙂

    This is a nice plugin and it is a shame that the developer isn’t responding to anyone.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Weather Forecast – WP Wunderground] Condition is "Fog" but wrong icon’ is closed to new replies.