Web Development Blog

Twitter

22 Feb, 2010

5 steps to creating a custom Archive page in WordPress

Web Development » Snippets, Tutorials, WordPress » 5 steps to creating a custom Archive page in WordPress


Here is how to create a custom archive page in WordPress just like the one you see on our blog.

1. Go to the current theme folder of your WordPress installation (wp-content/themes/*current theme*) and make sure you don’t already have archives.php in the folder

2. Create a new file called archives.php (or whatever file name you want to give)

3. Copy and paste the following code into the new file and upload it to your current theme folder (wp-content/themes/*current theme*)

<?php
/*
Template Name: Archives Page
*/
?>

<?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 Title:</h2>
<ul>
    <?php wp_get_archives('type=alpha');?>
</ul>

<h2>Archives by Month:</h2>
<ul>
    <?php wp_get_archives('type=monthly'); ?>
</ul>

<h2>Archives by Subject:</h2>
<ul>
    <?php wp_list_categories('title_li='); ?>
</ul>

<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
<?php endwhile; endif; ?>

<?php get_footer(); ?>

Note: You will probably need to modify this code a bit to match the code structure of your current theme. For example, you might need to have get_sidebar() or you might have extra markup.

4. Login to your WordPress Administrator Panel and create a new page (and name it whatever you like. Ours is called “Archive”)

5. On the right side of the create/edit page, you will see Attributes section where you can specify settings for Parent, Template and Order. Choose “Archives Page” for Template and publish/save your changes.

You now have an Archive page for your WordPress blog that is similar to our Archive page.

Other similiar posts that you might be interested in:

6 Responses to "5 steps to creating a custom Archive page in WordPress"

1 | 5 Steps Create A Archive Page In WordPress - Free Wordpress Themes Daily

February 23rd, 2010 at 1:08 am

Avatar

[...] details here. MAIN CONTENTS END ■ Posted in Article Tags: Howto, Wordpress 3 [...]

2 | Ash Blue

March 3rd, 2010 at 1:37 pm

Avatar

Not a bad tutorial, would be cool though if you could show us how to create an advanced/improved archives page thats different than the original.

3 | eisabai

March 5th, 2010 at 12:15 pm

Avatar

Thank you for the idea, Ash.

4 | Rezmason

March 9th, 2010 at 8:14 am

Avatar

I’m trying to follow your guide, and for some reason, despite having templates in my theme’s folder, the “Template” section of the Attributes menu on my dashboard does not appear. I cannot select a template to base a page on until I can make that section show up. Got any ideas?

5 | eisabai

March 9th, 2010 at 9:14 am

Avatar

Hi Rezmason, I haven’t had that problem before, but this might help: http://wordpress.org/support/topic/343384

6 | Jase

August 8th, 2010 at 11:31 am

Avatar

THANK YOU!! I’ve been struggling with this for days. Used your code as is and it worked a treat. When I have more time I’ll finesse the display but I’m a happy puppy right now. Many thanks!

Comment Form

ebook
Subscribe to our newsletter and receive FREE e-book "7 Days Exercise to Build More Traffic To Your Blog"
Your name:  
Your email:  

  • About
    The blog Web Development Blog is where I keep myself up to date with the latest technologies in the industry and share my ideas and thoug...
  • Adsense Tips and Tricks
    With personal and commercial blogs, community websites, and social pages becoming the hot topic of the Internet in the last few years, many...
  • Advertise With Us
    Web Development Blog is a blog about Web Development, Web Design, Web Applications, Web 2.0, AJAX, Search Engine Optimisation, Latest Techno...
  • Archive
    Grab yourself a cup of coffee or tea, sit back and browse through an archive of all the blog posts on Web Development Blog....
  • Choosing a Content Management System
    The most commonly asked question when it comes to Content Management System is whether to build or buy (pre-built). While there are many fa...
  • Coupons
    Use the following coupon codes, promos and discount codes to save money on web hosting, domain names, website templates, ebooks, software, p...
  • Customised WordPress Themes
    If you would like a customised WordPress theme for your blog or your website, read on: (or head to WordPress Themes page to get free WordPre...
  • Favourite Poems
    If by Rudyard Kipling If you can keep your head when all about you Are losing theirs and blaming it on you, If you can trust yourself w...
  • Favourites
    Books Web Development Books Magazines Glamour Reader's Digest Software Adobe Photoshop CS4 Trend Micro Antivirus + Antispyw...
  • How to Start a Blog?
    What's a blog? According to Wikipedia, a blog is a user-generated website where entries are made in journal style and displayed in a reve...
  • Introduction to JSP Standard Tag Library (JSTL Basics)
    Tag libraries to include in your .jsp page <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> &l...
  • Links
    Free Anonymous Proxy Increases your privacy and security on the Internet by using our free, fast and easy to use web proxy. data backu...
  • Making a Passive Income Online
    Passive income, in my opinion, means an income which does not require a lot of regular maintenance work or continuing effort. I have been t...
  • Online Distribution Channels
    One of the importances of any website or business is to bring your products or services to the right people and to reach the target audience...
  • Recent Projects
    Followings are some of the recent projects I have done in 2006 -- 2007. Check out my latest business venture Web design Sydney to get your...
  • Recommended Web Development Books
    Many developers often ask me what books I read and what books I recommend in regards to web development and web technologies such as AJAX, J...
  • Search
    Looking for something on Web Developement Blog? Use this search tool powered by Google Custom Search to find what you are looking for just ...
  • Seven Tips to Building an Online Presence for your Business
    1. Get a domain name for your business The first and foremost step in building an online presence is to secure a domain name for your busi...
  • Seven Tips to Increasing Your Website’s Traffic Using SEO
    SEO is the buzz word - many people have mentioned it and many have heard of it too, but very few people know how to implement it properly. ...
  • Subscribe
    Newsletter [newsletter] RSS 2.0 feeds Entries feed Comments feed Subscribe using your favourite web-based or desktop feed r...
  • Useful Linux Commands
    Find files older than 60 days find * -mtime +60 Delete files in backup folder which are older than 60 days rm -f `find /backup/ -mtime ...
  • Web Design Tips
    Nowadays, having a website for your business is like having a phone number. Almost every business has their own website, with their own doma...
  • Web Development Books
    Many developers often ask me what books I read and what books I recommend in regards to web development and web technologies such as AJAX, J...
  • Web Hosting Comparison Chart
    The following are some of the most popular web hosting providers. I have personally used the recommended ones. Hosting coupon codes will ...
  • Web Standards
    Web Standards is defined as a set of rules or specifications that should be followed when developing a website.  The main objectives o...
  • WordPress Themes
    All WordPress themes are designed and coded by esn studio, and licensed under GPL license. If you would like a customised WordPress theme fo...
  • Sam: Useful. I always forget the rel target one
  • Chronic Tinnitus: Hi, Thanks for taking the time to discuss a really confusing matter - I find Plesk so much more awkward than the cpanel that I'm used to. Thanks Chr
  • Serhiy: I personally liked the web hosting comparison chart. Especially the recommended *. I got Bluehost :) .-= Serhiy´s last blog ..

Interests

Web development, Web design, Open source technologies, Portal development, APIs, Web services, Social media applications, Search engine optimisation, Mobile application development, iPhone Apps, Web 2.0, Web 3.0, Latest Internet technologies

Misc.

  • bluehost Hosting $6.95/month
  • Joomla Templates