/** save XML file as sitemap_baidu.xml **/$GetHomePath=GetHomePath();$filename=$GetHomePath.'sitemap_baidu.xml';if(IsFileWritable($GetHomePath)||IsFileWritable($filename)){file_put_contents("$filename","$baidu_xml");@chmod($filename,0777);/** Messages **/baidu_sitemap_topbarmessage(__('Congratulate, Build the XML file success','baidu_sitemap'));}else{/** Messages **/baidu_sitemap_topbarmessage(__('Directory is not writable. please chmod your directory to 777.','baidu_sitemap'));}
添加入KVDB存储路径,修改后的代码为(去掉if里面条件判断)
1234567
/** save XML file as sitemap_baidu.xml **/$GetHomePath=GetHomePath();$filename="saekv://wordpress/sitemap_baidu.xml";file_put_contents("$filename","$baidu_xml");@chmod($filename,0777);/** Messages **/baidu_sitemap_topbarmessage(__('Congratulate, Build the XML file success','baidu_sitemap'));
2、再修改生成HTML地图文件那部分,跟上面的大同小异,未修改前的代码
12345678
$GetHomePath=GetHomePath();$filename_html=$GetHomePath.'sitemap.html';if(IsFileWritable($GetHomePath)||IsFileWritable($filename_html)){file_put_contents("$filename_html","$html");@chmod($filename_html,0777);/** Messages **//*baidu_sitemap_topbarmessage(__('Congratulate, Build the Html file success','baidu_sitemap'));*/}
修改后的代码段
123456
$GetHomePath=GetHomePath();$filename_html="saekv://wordpress/sitemap.html";file_put_contents("$filename_html","$html");@chmod($filename_html,0777);/** Messages **//*baidu_sitemap_topbarmessage(__('Congratulate, Build the Html file success','baidu_sitemap'));*/