WordPress Archive Page

There are many easy ways to create an exciting WordPress archives page for your WordPress website. However, the internet is littered with tons of WordPress tutorials that offer minimal guidelines in doing so. Some websites offer no information for people who have not comfortable with making WordPress page templates. Therefor, we created this article to help you easily create a WordPress Archive page for your webiste.

Create a WordPress Archive Page template

Each WordPress theme install should place an archive.php file in your WordPress directory located: wp-content > themes >your current theme. You can even access the Archive file in the WordPress Dashboard under the Appearance > Editor > Archives (archive.php).

Create a new PHP template page and title it anything along the lines of sitearchive.php, archive1.php. Though the actual title of the file can be anything, even spaghetti.php as long as it does not comprise other files such as index.php. If you are unsure of how to create a PHP file – produce a copy of an original PHP file already in existence on your computer.

Archive Page Skeleton

Here’s the basic outline of a WordPress archive page, let’s call it a skeleton. Copy and paste the following PHP code into your new Archive page/file and save/update it.

<?php
/*
Template Name: Archives
*/
get_header(); ?>

<div id="container">
	<div id="content" role="main">

		<?php the_post(); ?>
		<h1><?php the_title(); ?></h1>

		<?php get_search_form(); ?>

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

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

	</div><!-- #content -->
</div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Once the above code is pasted into your new archive page via Word Processor place it in your current theme’s folder here: wp-content > themes >your current theme

The Above Code Includes:

  • Search Form
  • Archives By Month
  • Archives By Category

Creating The Archive Page

  1. To create a new archive page for your WordPress website simply add a new page and select the Archives page template under the Page Attributes section.
  2. You do not need to add anything to the blank page. Once the page the draft is saved or page is published an archive page will appear for the give page URL and page title.

The same instructions to create a new archive page are used If you copied and pasted the code to a file already in existence (for example through the WordPress dashboard / archive.php file).

 Customizing The WordPress Archive Page (PHP Functions)

There are a lot of cool tricks that can be done to customize the WordPress archive page. Using the archive page skeleton supplied above, you can remove snippets (or keep them) and add new ones.

Reader Interactions

Leave a Reply

Your email address will not be published.