how to create an archives page in wordpress

I really am kicking walsho‘s ass today in terms of work rate :twisted: Whilst he moans about problems and crosses his fingers someone will help, i’m keeping my mouth shut, stealing his ideas on improving his blog, and working hard on finding some answers for myself :mrgreen:

Not only have i probably solved his time/date issue, i’m now gonna hit another nail on the head with a quick guide on how to pimp out an archives page and declutter that sidebar.

I found a nice little plugin call smart archives.

Download it, rename it to smartarchives.php, then upload to your plugins folder, and activate as usual in your wordpress admin panel.

The next bit is tricky. Have a look at wpdesigner’s post who offers more expert assistance, i’m just a noOb and a rookie with this crap (my way of giving me a get of a jail card free card).

Basically, you create a template called archives.php and save it in your theme files (eg; smemon.com/mytheme/archives.php) and it should contain code like this;

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

<?php get_header(); ?>

<div id=”content”>

<?php while(have_posts()) : the_post(); ?>

<div><h1>Archives</h1></div>
<p> </p>

<p><?php smartArchives(‘both’,”); ?></p>

<?php endwhile; ?>

</div> <!– content end –>

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

The code in red will not change. Keep it, if you want an Archives page like mine.

In plain english, the bits in green are for my theme, basically i’m just getting the header, sidebar and footer and putting them on a blank page to create a new page template. I’m then putting the plugin and a heading or two inside that template.

I can’t guarantee the above code will work (the bits in green), your theme files could be called something different or have extra stuff.. but to get a flavour of how your theme is laid out you can look at the archive.php file in your current theme and steal the layout and correct names from it, then replace green bits above :wink:

Once you’ve got that archives template done, you simply write a ‘new page’ in wordpress and title it ‘Archives’, leave it blank and change the page template to ‘Archives Template’ as seen below, then hit publish and BAM! You’re finished.

archivespage.jpg

That’s all for today folks *blows smoke off the top of my gun*…

  • http://www.leateds.com Sean

    Great stuff, helped me a lot

  • ovidiu

    I just wanted to follow your instructions but it seems with the newest version the plugin author of smart archives has changed some stuff. what version did you use for this tutorial?

  • smemon

    hmm… well i made that post back in january, so i’m not sure…

    at present, i’m using a plugin called ‘clean archives reloaded’ and it’s really simple to use – a lot simpler than doing all the above :mrgreen:

 

Your browser is out of date. It has security vulnerabilities and may not display all features on this site and other sites.

Please update your browser using one of modern browsers (Google Chrome, Opera, Firefox, IE 10).

X