主页 > 编程资料 > WordPress >
发布时间:2015-09-26 作者:网络 阅读:194次

废话不多说,直接上代码

复制代码代码如下:
require('./wp-blog-header.php');
header("Content-type: text/xml");
header('HTTP/1.1 200 OK');
$posts_to_show = 1000; // 获取文章数量
echo '';
echo 'http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 '" rel="external nofollow" >http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';
?>


http://localhost/

daily
1.0

header("Content-type: text/xml");
$myposts = get_posts( "numberposts=" . $posts_to_show );
foreach( $myposts as $post ) { ?>



monthly
0.6



复制上面代码为xmlmap.php文件并传至网站根目录
http://localhost/xmlmap.php

关键字词: