1、加入js。在该插件目录的template目录下的footer.php文件中加入“<script src="https://mipcache.bdstatic.com/static/v1.1/mip-audio.js"></script>”
2、修改i3geek_mip_standard.php,加入如下代码:
function audio($content){
$content=preg_replace('/<(\/audio.*?)>/si','</mip-audio>',$content);
$content=preg_replace("/<(audio.*?)><(.*?)(src)/si","<audio src",$content);
preg_match_all('/<audio (.*?)\>/', $content, $ifs);
if(!is_null($ifs)) {
foreach($ifs[1] as $index => $value){
$mip_audio = str_replace('<audio', '<mip-audio width=800 height=60', $ifs[0][$index]);
$mip_audio = preg_replace('/ srcset=\".*?\"/', '',$mip_audio);
$content = str_replace($ifs[0][$index], $mip_audio, $content);
}
}
return $content;
}