wordpress非插件实现xml格式网站地图

wordpress非插件实现xml格式网站地图,第1张

wordpress="superseo">ss非插件实现xml格式网站地图

本文详细介绍了wordpress非软件xml格式网站图,朋友们一定要参考。

事不宜迟,立即上传代码

,复制以下代码:
<?PHP
要求('。/WP-blog-header.PHP');
header("Content-type:text/XML");
header('HTTP/1.1200OK');
$posts_to_show=1000;//获取文章总数
echo'<?xml版本="1.0"编码="UTF-8"?>';
echo'<;urlsetxmlns:xsi="<;ahref="http://www.w3.org/2001/XMLschema-instance"rel="externalnofollow">。http://www.w3.org/2001/XMLSchema-instance</a>xmlns="<ahref="http://www.sitemaps.org/schemas/sitemap/0.9"rel="externalnofollow"rel="externalnofollow">。http://www.sitemaps.org/schemas/sitemap/0.9</a>
xsi:schemalocation="<;ahref="http://www.sitemaps.org/schemas/sitemap/0.9"rel="externalnofollow"rel="externalnofollow">。http://www.sitemaps.org/schemas/sitemap/0.9</a>;<ahref="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">;"rel="externalnofollow">'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'</a>;;
?>
<;!-generated-on=<;?PHPechoget_lastpostdate('blog');?>->;
<;url>
<;loc>http://localhost/<;/loc>;
<;lastmod><?PHPechoget_lastpostdate('blog');?></lastmod>;
<;changefreq>每日</changefreq>;
<;优先级>1.0</priority>;
<;/URL>;
<;?PHP
header("Content-type:text/XML");
$myposts=get_posts("numberposts="。$posts_to_show);
foreach($mypostsas$post){?>
<;url>
<;loc><?PHPthe_permalink();?></loc>;
<;lastmod><?phpthe_time('c')?></lastmod>;
<;changefreq>每月</changefreq>;
<;优先级>0.6</priority>;
<;/URL>;
<;?php}//endforeach?>
<;/urlset>;

用上面的代码复制xmlmap.php文件,发送到网站的根目录
http://localhost/XMLmap.PHP

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zz/772484.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-03
下一篇 2022-05-03

发表评论

登录后才能评论

评论列表(0条)

保存