wordpress对应微信小程序 文章中显示图片过渡/加载 动画(loading.gif),且无法消失

在制作对应的wordpress微信小程序后,发现对应的文章中一直存在图片的加载动画,且无法消失。

其原因为懒加载问题,解决方法也很简便。

打开wordpress主题下的\inc\feature.php

将含有lazyload的代码段注释掉即可,即注释类似以下的代码段

//if (cs_get_option('i_function_lazyload_switcher')) {
    add_filter ('the_content', 'lazyloadImagesReplace');
    function lazyloadImagesReplace($content) {
        $loadingImg = get_bloginfo('template_directory').'/assets/images/loading.gif';
        if(!is_feed()) {
        $content=preg_replace('/<img(.+)src=[\'"]([^\'"]+)[\'"](.*)>/i',"<img\$1data-echo=\"\$2\" src=\"$loadingImg\"\$3>\n<noscript>\$0</noscript>",$content);
//            $content=str_replace(" src=", "data-echo=", $content);
        }
        return $content;
    }
//}
发布了87 篇原创文章 · 获赞 324 · 访问量 48万+

猜你喜欢

转载自blog.csdn.net/qq_35379989/article/details/101172621