How to Create Archive Page Manually in WordPress

Here is a tiny guide to create archive page without using any plugin in WordPress. Today’s script let users to create archive page with the help of PHP. You know that WordPress covers with so many plugins, themes and codes. And today we just make use of that opportunity and create archive page for your personal weblog so that you can help your reader to read your entire site from one place.

Why you know create archive page for readers?

Actually, I follow mattcutts.com everyday because he is a SEO expert as well as the head of Google Web Spam Team. And one of his video says that you should create two sitemaps. One with .xml extension that will be accessed by bots /crawlers and the next one is for your readers. Here is a video, please check it out;

There are so many plugins like Grid Archive that could create a good looking archive page but your reader might face various problems with that page. Why? I used to activate those kind of plugins previously and it took more that 15 seconds to load a page. It might be a reason of low traffic. So, along with changing my theme, I did change that page with a new one. (You can check it out from here.) And today I am going to tell you how to create such a page within minutes.

How to create archive page manually?

At first copy the following code and paste it in your notepad and then save it as archives.php. Do not change the name or do not make it archive.php because most of the WordPress themes have a built-in archive.php.

<?php /* Template Name: Get All Posts */ ?> <?php get_header(); ?>

<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class=”post-page” id=”post-<?php the_ID(); ?>”> <h1><?php the_title(); ?></h1> <?php the_content(‘<p class=”serif”>Read the rest of this page &raquo;</p>’); ?> <h2>Archives by Month:</h2> <ul> <?php wp_get_archives(‘type=monthly’); ?> </ul>

<h2>List of authors:</h2> <ul> <?php wp_list_authors(); ?> </ul>

<h2>Archive By Category:</h2> <ul> <?php wp_list_categories(); ?> </ul> <h2> Archives by Tag: </h2> <ul> <?php $tags = get_tags(); foreach ($tags as $tag) { echo ‘<li><a href=”http://www.versedtech.org/tag/’.$tag->slug.'” rel=”tag”>’.$tag->name.'</a></li>’; } ?> </ul>

Do Check:

<h2>Archives by Post:</h2> <ul> <?php wp_get_archives(‘type=alpha’);?> </ul> <?php wp_link_pages(array(‘before’ => ‘<p><strong>Pages:</strong> ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?> </div> <?php endwhile; endif; ?>

<?php get_footer(); ?>

Just replace the site name with mine and then upload it to your current theme directory. You theme directory may be found in something like the following arena;

sign in to hosting panel >> File Manager (public_html) >> wp-content >> themes >> current theme name

 

Hence you have to create a new page and select Get All Post from Template under Page Attribute.

Problems with this page:

  1.  Your author names will be placed as alphabetically. You cannot edit them with this existed code.
  2. You can find a category that is called uncategorized which was created when you installed WordPress for the first time.
  3. Your post will be shown in random. You cannot show latest post at first with the help of this code.

That’s all! If you have any other query regarding to this article or if you will face any kind of problem during creation of this kind archive page, contact with us. You will try to help you as enough as possible.


Feel Free to share your thoughts in the comment section below.
Don't forget to follow us on Twitter, like our Facebook Fan Page and Add us to your circles on Google+ to keep you updated with the latest technology news, gadget reviews, launches around the world and much more
Tagged with 
About Pulkit Juneja
Pulkit Juneja, is the founder of Versed Tech. A born tech savvy guy who loves to write content on latest technology news, Gadget reviews, android app reviews, SEO and Much More. Connect with us at pulkit@versedtech.org