Create a Unique Site Map for Your WordPress Blog
Daniel recently asked the following question about WordPress blog site maps, and the site map created for use on this blog in particular:
I have a question about the NetProfit’s sitemap, that I see is also being used as a 404 not found page. Was the sitemap created manually or by using some type of an automated system or sitemap 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 site map that came with the Lifestyle 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=”http://www.netprofitstoday.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.
Related Posts
- Thesis Theme for WordPress: An Overview
- How to Get Rid of the Lifestyle Theme Sidebar Blogroll
- Wishlist Member Review: How to Turn Your WordPress Blog into a Membership Site
- Test Your Blog Offline: Install WordPress on Your PC
- How Do I Connect My Site and My Blog?
Need more info?
Rosalind Gardner is a Super Affiliate blogger, author, speaker, and Internet marketing consultant. For more info, subscribe to her No-Hype, No-BS, No Spam NPT newsletter and join Affiliate Blogger PRO to get answers to all your affiliate marketing questions. Thanks for visiting!







I may just stick with plugins myself for now. I have enough on my plate right now without learning php, but it’s great to know this information is here for in the future when I’ll need it.
– Jeffery
For those of us who break out in hives at the mere sight of a PHP tag, there’s Table of Contents Creator, which you could see in action at http://www.pswsc.com under Customer Care as Site Directory.
I say “could” as I don’t know what the policy is for placing links. Ros, if you want to take that one out, I’ll completely understand!
Hi Casey,
Where did you find the Table of Contents Creator creator? Is it a plugin?
Cheers,
Ros
Thanks Ros for all the great tips and helps you offer on your site. I think you are one of the best friends and resource a marketer could have on the net.
keep the faith,
Richard
Hi Ros,
When you mention “latitude” how much do you think you get? I mean does this really make a difference?
I use the google sitemap generator but would be willing to try the suggestion in your post if it really make a difference?
M
Hi Matt,
By ‘latitude’ I guess I really meant flexibility. You can do so much more when you hardcode, as opposed to when you use a plugin.
Hope that helps!
Cheers,
Ros
Just a little add-on to this Ros…
“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.”
It shouldn’t actually be one or the other… you should really do both as each of them serve a different purpose. You can’t submit the hardcoded version to Google Webmasters, Yahoo etc. as a sitemap in the same way as you can with the one that the XML sitemap generator creates. The latter is actually more important, so you should do both.
~ Paul
Hello Ros,
Although this information has been posted for a long time but I have found it to be of immense benefit to me. Because I was meant to understand that for google robots to crawl your site you need to have a site map in place. This information will help me to create a site map for my blog.
I also understand it helps significantly in a site’s search engine page rank.
Thanks for all the information.