Daniel recently asked the following question about the site map created for use on this blog:
I have a question about your blog's sitemap. Was it created manually or by using some type of automated system or generator? Cause if I can, I'd like to create one for my website? Please advise. I'd appreciate it. Thanks in advance!
The site map on this blog was created with some minor manual modifications to the default one that came with the StudioPress theme, a file named page-archive.php.
The site map that comes with the default WordPress theme is called the Archive Page Template and the file is named archives.php.
Here is the coding in the default WordPress template.
<?php
/**
* @package WordPress
* @subpackage Default_Theme
*/
/*
Template Name: Archives
*/
?><?php get_header(); ?>
<div id=”content”>
<?php get_search_form(); ?>
<h2>Archives by Month:</h2>
<ul>
<?php wp_get_archives(‘type=monthly'); ?>
</ul><h2>Archives by Subject:</h2>
<ul>
<?php wp_list_categories(); ?>
</ul></div>
<?php get_footer(); ?>
Here is the coding for the current NPT site map, named site-map.php. Coding will be deciphered later in this post.
<?php
/*
Template Name: Site Map
*/
?><?php get_header(); ?>
<div id=”content”>
<div id=”contentleft”>
<div>
<?php include(TEMPLATEPATH.”/breadcrumb.php”);?>
<h1><img src=”https://rosalindgardner.com/images/300-map.png”  style=”float: right; padding: 0px 0px 10px 10px” border=”0″>Archives and Site Map</h1>
<h2>Main Pages</h2>
<ul>
<?php wp_list_pages(‘title_li=&depth=2&exclude=2938,1683'); ?>
</ul>
<h2>Popular Posts</h2>
<ul>
<li>
<?php wp_list_bookmarks(‘title_li=&categorize=0&category=831'); ?>
</li></ul>
<hr>
<h2>Last 25 Posts</h2>
<ul>
<?php wp_get_archives(‘type=postbypost&limit=25'); ?>
</ul></div></div></div>
<?php include(TEMPLATEPATH.”/sidebar.php”);?>
</div>
<!– The main column ends –>
<?php get_footer(); ?>
Main Pages
To list all the pages on your blog, you would use the code:
<?php wp_list_pages('title_li=');Â ?>
Because I wanted to show subpages (depth) and not show (exclude) others, I used the following code:
<?php wp_list_pages(‘title_li=&depth=2&exclude=2938,1683');
depth=2 specifies that I want the subpages to show 2 levels deep.
For more information about visit the Template Tags/wp list pages page on the WordPress Codex.
Popular Posts
The list of most popular posts is generated by a links (bookmarks) list, all filed under the ‘Popular' category, numbered 831.
<?php wp_list_bookmarks('title_li=&categorize=0&category=831'); ?>
For more information about the coding used to display bookmarks, see Template Tags/wp list bookmarks on the Codex.
Last 25 Posts
To create a list of the most recent 25 posts, I use the following code.
<?php wp_get_archives(‘type=postbypost&limit=25'); ?>
To learn more about coding bookmarks lists visit Template Tags/wp get archives on the WordPress Codes.
Or, you could always just use a site map plugin, but you won't have the same latitude as you do when you hardcode the template. 🙂