高级搜索
[ CLOSE ]
好消息: 本站当前使用的模板可进行功能定制出售(可定制模板部分功能或完整功能),有意请与我们联系。欢迎到“模板超市”看看。

WordPress 非插件建立 Sitemap

为网站建立Sitemap可以有助搜索引擎收录,除了使用插件外,我们也可以使用以下方法进行手工制作。

  1. 在你的主题目录中,新建文件:sitemap.php。在其开始部分添加如下代码:
    <?php
    /*
    Template Name: Sitemap Page
    */
    ?>
  2. 把你的主题目录内的page.php的内容复制到上面的新建文件中。把其中的<?php the_content() ?>改为:
    <ul>
    <?php $post_archives = new wp_query(’showposts=1000′);
    while ( $post_archives->have_posts() ) : $post_archives->the_post(); ?>
    <li>
    <span><a href=”<?php the_permalink() ?>” title=”<?php printf(__( ‘Permalink to %s’, ‘theme-name’ ), wp_specialchars( get_the_title(), 1 ) ) ?>” rel=”bookmark”><?php the_title(); ?></a></span>
    </li>
    <?php endwhile; ?>
    </ul>
  3. 然后在WordPress的后台新建页面,内容空白即可,在模板选择“Sitemap Page”则可。

[ 转载请注明 ] 本文来自:下一页工作室,永久链接:


  • 我喜欢!有 0 位朋友喜欢此文
    喜欢就点击
    ( 0 )
  • 有 27 位朋友围观此文
    猛击继续围观
    ( 27 )
  • 沙发还在
    点击发表见解
    ( 0 )






发表见解

(必填)

(必填)

(以便回访)