百度
360搜索
搜狗搜索

wordpress非插件实现xml格式网站地图详细介绍

这篇文章主要介绍了wordpress非插件实现xml格式网站地图,需要的朋友可以参考下

废话不多说,直接上代码

代码如下:

<?

require('./-blog-header.php');

header("Content-type: tex LLntflDGt/");

header('HTTP/1.1 200 OK');

$posts_to_show = 1000; // 获取文章数量

echo '<?xml version="1.0" encoding="UTF-8"?>';

echo '<urlset xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" rel="external nofollow" >http://www.w3.org/2001/XMLSchema-instance</a>" xmlns="<a href="http://www.sitemaps.org/schemas/sitemap/0.9" rel="external nofollow" rel="external nofollow" >http://www.sitemaps.org/schemas/sitemap/0.9</a>"

xsi:schemaLocation="<a href="http://www.sitemaps.org/schemas/sitemap/0.9" rel="external nofollow" rel="external nofollow" >http://www.sitemaps.org/schemas/sitemap/0.9</a> <a href="http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'" rel="external nofollow" >http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'</a>;

?>

<!-- generated-on=<?php echo get_lastpostdate('blog'); ?>-->

<url>

<loc>http://localhost/</loc>

<lastmod><?php echo get_lastpostdate('blog'); ?></lastmod>

<changefreq>daily</changefreq>

<priority>1.0</priority>

</u
客栈rl>

<?php

header("Content-type: text/xml");

$myposts = get_posts( "numberposts=" . $posts_to_show );

foreach( $myposts as $post ) { ?>

<url>

<loc><?php the_permalink(); ?></loc>

<lastmod><?php the_time('c') ?></lastmod>

<changefreq>monthl
y</changefreq>

<priority>0.6</priority>

</url>

<?php } // end foreach ?>

</urlset>

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

本文标题: wordpress非插件实现xml格式网站地图 ,

网站数据信息

"wordpress非插件实现xml格式网站地图"浏览人数已经达到44次,如你需要查询该站的相关权重信息,可以点击进入"Chinaz数据" 查询。更多网站价值评估因素如:wordpress非插件实现xml格式网站地图的访问速度、搜索引擎收录以及索引量、用户体验等。 要评估一个站的价值,最主要还是需要根据您自身的需求,如网站IP、PV、跳出率等!