效果图:

教程开始
1.安装php拓展Fileinfo(api调用时需要)
2.将下面代码放入wordpress后台-子比主题设置-全局-自定义代码-自定义css代码中
.posts-mini {
background-size: cover;
margin-bottom: 5px;
padding: 15px;
}
将下面代码添加到自定义代码中的自定义JavaScript代码中
var postsMiniElements = document.querySelectorAll('.posts-mini');
postsMiniElements.forEach(function(element) {
var randomBase64 = btoa(Math.random().toString(36).substr(2, 9));
var url = '/wp-content/themes/zibll/img/moxing/cebian/tfapi.php?kid=' + randomBase64;
element.style.backgroundImage = 'url(' + url + ')';
});
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

评论(1)
楼主听话,快到碗里来!