I tried to improve my WordPress performance, and already put the content <img> with jQuery LazyLoad.

Now, I got some problem in changing the smilies src, already set the theme smilies add



function light_smilies_src($img_src,$img,$siteurl) {
    return get_bloginfo('template_directory').'/images/smilies/'.$img;

When I added...

$img="<img data-original=\"{$file}\" alt=\"{$smile}\" />";

it shows...


How can I change it to something like below?

<src="" data-original="http://XXX.com/wp-content/themes/Moxx/images/smilies/icon_mad.gif"

You have to use the same quotes around the src attribute as WordPress uses. So filter the URL like this:

add_filter( 'smilies_src', function( $src ) {
    return "' data-original='$src";

And while I was on it, I noticed the doc block for the function translate_smiley() is wrong, so I have written a small patch. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.