• Resolved JeppeBlomgren

    (@jeppeblomgren)


    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

    https://www.ads-software.com/extend/plugins/wunderground/

Viewing 9 replies - 1 through 9 (of 9 total)
  • 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);

    Thread Starter JeppeBlomgren

    (@jeppeblomgren)

    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;
    }
    Thread Starter JeppeBlomgren

    (@jeppeblomgren)

    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?

    Change $myFileType = ‘.gif’;
    to $myFileType = ‘.png’;

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

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

    Thread Starter JeppeBlomgren

    (@jeppeblomgren)

    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

    Thread Starter JeppeBlomgren

    (@jeppeblomgren)

    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

    Thread Starter JeppeBlomgren

    (@jeppeblomgren)

    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

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Custom Icons’ is closed to new replies.