pdf icons

Archiving Posts In WordPress

In WordPress, you cannot manually send post(s) to an archive. They’re listed on archive pages automatically. Archive pages are just a way of viewing lists of posts sorted by date. You have to edit the archive.php file to display post(s) in archives.

If your theme does not contain a archive.php file, the following tutorial will teach you how to create this file and assign it to a page.

Creating An Archive Template And Assigning To A Page

To set up a separate archive you’ll need to create an Archive Page, and assign this to a specific archives template.

Since the archives template does not exist you will have to create one. To do this open any editor of your choice and create and empty file named archives.php in the root folder of the active WordPress theme.

Next copy and paste the following the codespec into the archives.php file.

	Template Name: Archives



<div id="container"> 
	<div id="content"  role="main"> 
		<?php the_post(); ?>
		<h1 class="entry-title"><?php the_title(); ?></h1>
		<?php get_search_form(); ?>
		<h2>Archives by  Month:</h2>
			<?php wp_get_archives('type=monthly'); ?>
		<h2>Archives by Subject:</h2>
			<?php wp_list_categories(); ?>
	</div><!-- #content -->
</div><!--  #container -->

<?php get_sidebar();  ?>

<?php get_footer(); ?>

The file archives.php ( i.e. the special archives theme ) is now ready for use.

Next you’ve got to create a page in your WordPress driven Blog and assign the newly created – archives – template to it. To do so login to WordPress as administrator, by simply entering the url_of_your_website/wp-admin in your Browser. Enter the appropriate username and password {which was provided while installing WordPress} and then click on Log In as shown in Diagram 1.

Diagram 1

After logging in as WordPress Admin, a Dashboard page opens as shown in Diagram 2.

The Dashboard provides access to different WordPress functions and features.

Diagram 2

In the left menu, locate the link Pages. Click on Pages, from the drop down menu that appears click on Add New as shown in Diagram 3.

Diagram 3

The “Add New Page” screen is displayed in your Browser as shown in Diagram 4.

Enter “Site Archives” as the page title in the page title text box as shown in diagram 4

Leave the content of the page empty. In the left hand, sidebar, click the Default template drop down list box and select the Archives template as shown in diagram 4.

Click Publish as shown in Diagram 4.

Diagram 4

In the front end of website, Click the Top Menu item Site Archive as shown in Diagram 5.

Diagram 5

A page is displayed where you will get to see all your archives sorted neatly by month.

Diagram 6

April 28, 2016
Design by Ivan Bayross and Meher Bala © 2017 All Rights Reserved