Wordpress Sitemap Tutorial
Posted By Andrew NL on November 19, 2009

How to install an sitemap into your wordpress:

Step 1) Open notepad or any text editing program.

Step 2) Copy and paste the given code below and save your document as sitemap.php

<?php
/*
Template name: Sitemap
*/
?>

<?php get_header(); ?>

<div id=”container”>
<br />
<h2 id=”post-<?php the_ID(); ?>”><?php the_title();?></h2><br />

<h4>Pages:</h4>

<ul>
<?php wp_list_pages(‘title_li=’); ?>
</ul>

<br />
<h4>Posts by category:</h4>

<?php $cats= get_categories(); ?>

<?php foreach ($cats as $cat) { ?>

<?php query_posts(‘cat=’ . $cat->cat_ID); ?>

<h6><?php echo $cat->cat_name; ?></h6>

<ul>
<?php while (have_posts()) : the_post(); ?>
<li>
<a href=”<?php the_permalink(); ?>/#content” title=”<?php the_title(); ?>”><?php the_title(); ?></a>
(<?php echo $post->comment_count ?> Comments)
</li>
<?php endwhile; ?>
</ul>

<?php } ?>

<br />
<h4>Posts:</h4>

<ul>
<?php $my_query = new WP_Query(’showposts=1000000′); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?>
<li><a href=”<?php the_permalink(); ?>/#content” title=”<?php the_title(); ?>” ><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>

</div>

<?php get_footer(); ?>

Step 3) Upload the sitemap.php file into your server under /wp_content/themes/”Your theme name”/

Step 4) Sign in into your wordpress and create a new page and call it sitemap.

Step 5) Once your page is fully setup, set the template to sitemap

Step 6) And your done! now it is time to edit and design :)

VN:F [1.8.1_1037]
Rating: 5.0/5 (1 vote cast)
Wordpress Sitemap Tutorial5.051
  • Share/Bookmark
Category: Tutorials | No Comments » Tags: , , ,
Post Your Comment

General Information
Education The Art Institute of Washington Bachelors Degree
Web Design & Interactive Media
Graduation: December 2010
Messenger
AIM AIM|AndrewNLeon
Yahoo Yahoo|djatek@yahoo.com
MSN MSN|puerto_phili_drew@hotmail.com
Statistics
RSS Feed RSS Feed - Login Admin Login
©2009 www.Andrewnl.com, All Rights Reserved. - Proudly Powered by WordPress