rss

About Me

My Photo
irnanto dwi saputra
View my complete profile
Showing posts with label Wordpress. Show all posts
Showing posts with label Wordpress. Show all posts

12 November 2012

How To Create a Sitemap in Wordpress

Sitemap is a page that shows the parts or links contained on the site. Sitemap devoted to two things for search engines and for the user (human). This time I will give a little tutorial on how to create a sitemap in wordpress for user. Here I am using a CMS wordpress hosting service that has the facility to use a PHP file. OK we just practice how to create a sitemap in wordpress.
The steps that you should follow the following :
  1. Login to cpanel your website
  2. Open the file manager
  3. Go to the directory of your website template is being actively used
    example: public_html / wp-content / themes / name-theme
  4. Create a new file with the name sitemap.php
  5. Copy or type the code below in file sitemap.php
    <?php
    /*
    Template Name: Sitemap
    */
    ?>
    <?php get_header(); ?>

    <div id="content" >
      <div class="post">
        <div class="title">
          <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
            <?php the_title(); ?>
    <!-- ----------------- Display Post with its relative category ----------------- -->
            </a></h2>
        </div>
        <div class="entry siteMap">
          <h2 id="posts">Posts</h2>
          <ul>
            <?php
    // Add categories seprated with comma (,) you'd like to hide to display on sitemap
    $cats = get_categories('exclude=');
    foreach ($cats as $cat) {
      echo "<li><h3>".$cat->cat_name."</h3>";
      echo "<ul>";
      query_posts('posts_per_page=-1&cat='.$cat->cat_ID);
      while(have_posts()) {
        the_post();
        $category = get_the_category();
      
        for($xi=0;$xi<=5;$xi++){
        if ($category[$xi]->cat_ID == $cat->cat_ID) {
          echo '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>';
        }
        }
      }
      echo "</ul>";
      echo "</li>";
    }
    ?>
          </ul>
    <!-- ----------------- Display Categories ----------------- -->
          <h2>Categories</h2>
          <ul>
            <?php wp_list_cats("sort_column=name&feed_image=/wp-content/themes/wizer/images/rss-ball.jpg&optioncount=1&hierarchical=0"); ?>
          </ul>
    <!-- ----------------- Display Pages ----------------- -->
          <h2 id="pages">Pages</h2>
          <ul>
            <?php
    // Add pages seprated with comma[,] that you'd like to hide to display on sitemap
    wp_list_pages(
      array(
        'exclude' => '',
        'title_li' => '',
      )
    );
    ?>
          </ul>
        </div>
      </div>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
  6. Save file sitemap.php
  7. Login to your-domain/wp-admin
  8. Click the page menu
  9. Select add new
  10. Type the title "Sitemap" without quotes
  11. On the Page Attributes -> Template
    How To Create a Sitemap in Wordpress
  12. Select sitemap
  13. Click Publish
Now look at the results in your web menus. For demo please visit this website.
Read more.....
 

Site Info

Google Pagerank Powered by  MyPagerank.Net My Ping in TotalPing.com TopOfBlogs My Zimbio Blog Directory