You must be logged in to post


Register? | Lost Your Password?

Search Forums:


 






Wildcard Usage:
*    matches any number of characters
%    matches exactly one character

Sitemap code

UserPost

2:48 pm
November 20, 2009


Jayman

Member

posts 20

1

Post edited 7:49 pm – November 20, 2009 by Jayman
Post edited 7:52 pm – November 20, 2009 by Jayman


I'm not sure if anybody is in need or wants to add a sitemap to there site.  If so here is a php file that will generate one.  After adding several hundred products to my site it was neccessary for me to make a sitemap for my website, and figured I would share with others that may find it of use.

Just save the file as sitemap.php and upload to you themes folder.  Next go and create a new page and select the page template that this file created "Sitemap".  That's it very easy and it will help your customers locate all your pages, and helps with search engines indexing your site. 

Here is what it looks like on my site.   http://www.stonesthatrock.net/sitemap

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

<?php get_header(); ?>
        
    <div id="content_box">

        <div id="content" class="page">
        
            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
            
            <h1><?php the_title(); ?></h1>
            <div class="entry">
                <p><strong>All internal pages:</strong></p>
                <ul>
                    <?php wp_list_pages('title_li='); ?>
                </ul>
                <p><strong>All products:</strong></p>
                <ul>
                    <?php $archive_query = new WP_Query('showposts=1000');
                        while ($archive_query->have_posts()) : $archive_query->the_post(); ?>
                    <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> </li>
                    <?php endwhile; ?>
                </ul>
                <p><strong>Product added in:</strong></p>
                <ul>
                    <?php wp_get_archives('type=monthly'); ?>
                </ul>
                <p><strong>Product Categories:</strong></p>
                <ul>
                    <?php wp_list_categories('title_li=0'); ?>
                </ul>
                <p><strong>Available RSS Feeds:</strong></p>
                <ul>
                    <li><a href="<?php bloginfo('rdf_url'); ?>" title="RDF/RSS 1.0 feed"><acronym title="Resource Description Framework">RDF</acronym>/<acronym title="Really Simple Syndication">RSS</acronym> 1.0 feed</a></li>
                    <li><a href="<?php bloginfo('rss_url'); ?>" title="RSS 0.92 feed"><acronym title="Really Simple Syndication">RSS</acronym> 0.92 feed</a></li>
                    <li><a href="<?php bloginfo('rss2_url'); ?>" title="RSS 2.0 feed"><acronym title="Really Simple Syndication">RSS</acronym> 2.0 feed</a></li>
                    <li><a href="<?php bloginfo('atom_url'); ?>" title="Atom feed">Atom feed</a></li>
                </ul>
            </div>
                
            <?php endwhile; endif; ?>
            
        
<?php get_footer(); ?>

4:01 pm
November 20, 2009


Market Admin

Admin

posts 4728

2

Thanks a lot!  That's a great one to share.

12:54 am
November 23, 2009


Warnold

Australia

Member

posts 99

3

Thanks jayman

just added the sitemap to my site worked really well

Susan

3:44 am
February 13, 2011


Piper1

Florence

Member

posts 16

4

Exactly where do you place the code?  Do you find this themes folder in editor?  Could you be more detailed on the exact placement of your code, I am very new to this, 1 month in, as a matter of fact.  I find this code very valuable as my site is getting too large also. Piper

I can't believe how much I am learning from all the mistakes I make…Piper1

1:44 pm
February 14, 2011


Market Admin

Admin

posts 4728

5

Save the above template as a file in your Market Theme files area.

 

Then, through your WordPress administration area, create a new page named "site map" or whatever.  On that newly created page, choose the "Sitemap" page template and save.



 

Market takes e-commerce to the next level with an easy to use, quick setup platform. Learn more or take the tour.