WordPress.org

Ready to get started?Download WordPress

Forums

Weather Forecast - WP Wunderground
[resolved] Custom Icons (10 posts)

  1. JeppeBlomgren
    Member
    Posted 1 year ago #

    Hi,

    can't get the preg_replace to work in my functions.php file. I use the code under FAQ but nothing happens. The default images are still showing.

    I have set the to:
    $myFileType = '.png';

    And the URL to the image folder looks like this:
    $myIconFolder = 'dev.skisunne.se/wp-content/themes/SkiS-2/include/css/images/wicons/';

    Any ideas?

    Cheers / Jeppe

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

  2. daveyank
    Member
    Posted 1 year ago #

    I had the same issue yesterday. I changed the following line (note the "-ak" part):

    $content = preg_replace('/http\:\/\/icons\-ak\.wxug\.com\/i\/c\/[a-z]\/(.*?)\.gif/ism', $myIconFolder.'$1'.$myFileType, $content);

  3. JeppeBlomgren
    Member
    Posted 1 year ago #

    Hey daveyank,

    that unfortunately did'nt change anything for me. I must do something else wrong.

    I'll post the whole code here. See anything abnormal?

    add_filter('wp_wunderground_forecast_icon', 'use_custom_wunderground_icons');
    function use_custom_wunderground_icons($content=null) { 
    
        $myIconFolder = 'dev.skisunne.se/wp-content/themes/SkiS-2/include/css/images/wicons/';
        $myFileType = '.gif';
        $content = preg_replace('/http\:\/\/icons\-ak\.wxug\.com\/i\/c\/[a-z]\/(.*?)\.gif/ism', $myIconFolder.'$1'.$myFileType, $content);
        return $content;
    }
  4. JeppeBlomgren
    Member
    Posted 1 year ago #

    Hi again, after a little while with the above code it all of a sudden changed url to my images. Allthough, how do I do if I want my own images to be png:s instead of gif:s?

  5. MixedMediaGraphics
    Member
    Posted 1 year ago #

    Change $myFileType = '.gif';
    to $myFileType = '.png';

  6. MixedMediaGraphics
    Member
    Posted 1 year ago #

    I have been trying to figure out a way to change the icon size, has anyone figured that out yet?

  7. MixedMediaGraphics
    Member
    Posted 1 year ago #

    I have been trying to figure out a way to change the icon size, has anyone figured that out yet?

  8. JeppeBlomgren
    Member
    Posted 1 year ago #

    Thanks MixedMediaGraphics. I tried that but then it just reverts to the standard url. Really wierd. And also it takes a very long time to see the changes.

    About icon size. Can't you just change the size of the image? Or, just find the riggt css-selector and modify that?

    cheers

  9. JeppeBlomgren
    Member
    Posted 1 year ago #

    It would be great if the author commented on this. It's obvious something is not right. I just now change my filetype again top .png. And the url still looks in my icons folder for a .gif. Is there some sort of cache function in this plugin that takes a lot of time to update?

    cheers again

  10. JeppeBlomgren
    Member
    Posted 1 year ago #

    Hello all,

    just wanted to say that my orignial issue is solved. For some reason the first feedback of this post solved it:

    I had the same issue yesterday. I changed the following line (note the "-ak" part):

    $content = preg_replace('/http\:\/\/icons\-ak\.wxug\.com\/i\/c\/[a-z]\/(.*?)\.gif/ism', $myIconFolder.'$1'.$myFileType, $content);

    It's just the issue of it being very slow to react to the new setting. Maybe this is my server playing tricks on me. I don't know.

    Thanks everyone for your help
    cheers / Jeppe

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic