Categories: PluginsTips & Tricks

How to: Creating an Archive page

Many weblog sites these days have some form of an archive page. In WordPress it might be the built in auto generation of permalinks by: /Month/ and /date/.

But in some blog’s, for instance this one here (as I said in a previous post) you can’t get the post to paginate or link to http://youblog.com/page/2 if you have nice permalinks active or http://youblog.com/?paged=2.

By any means, In this theme I have to have an archive link at the bottom. So..

Archive WordPress Plugins

There are many plugins which allows you to automatically create an archive page. The good thing is that you’ll (almost) have nothing to do, and the bad thing is that you may not be able to customize your archives much.

On this blog I have decided to use Clean Archives Reloaded by Viper007Bond. Which you can now see active in my Archive’s page.

If you want to use a plugin, here is a small list:

And of coarse you can always..

..do it your self!

First you would have to create a template file by writing this:

<?php
/*
Template Name: Archive page
*/
//please add you necessary code here
//ie. your hooks and html code ?>

<ol id="archive">
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts(array(
    'showposts' => 100,
    'offset' => 10,
    'order' =>'DES',
    'paged' => $paged,
    ));
    $wp_query->is_archive = true; $wp_query->is_home = false;

    if( have_posts() ) : while( have_posts() ) : the_post(); ?>

    <li><a href="<?php the_permalink() ?>"><?php $tit = the_title('','',FALSE); echo substr($tit, 0, 25); ?>...</a> - Posted on <?php the_time('j F Y') ?> - Comments (<?php echo $post->comment_count ?>)</li>

<?php endwhile; endif; ?>
</ol>

?>

You may notice this code: <?php $tit = the_title('','',FALSE); echo substr($tit, 0, 25); ?> from a previous post!

Once saved and pasted it to your archives.php or template-archives.php file, upload it on your wp-content/themes/yourtheme/ directory.

Then, in WordPress dashboard, create a new page, name it “Archives” (or whatever you want) and select Archive page as your page template.

enjoy!

Web Master

Hi, I am Miguel, I bought this site in 2009. So I now run or manage the site. Please visit my new website or follow me on twitter @W3i.

View Comments

Recent Posts

21 Effective Strategies to Amplify Website Traffic

The article provides a comprehensive guide to driving traffic to your website, highlighting 21 effective…

7 hours ago

Essentials for Ecommerce Website Development

While e-commerce is projected to account for more than $6.5 trillion in sales by 2023,…

5 hours ago

17 Essential Link Building Statistics and Trends for Enhanced SEO

The analysis highlights the significance of link-building in SEO, revealing that most websites neglect backlinks,…

17 hours ago

Get a copy of the book Blog Blazers!

Hey everyone, I've got two copies of Blog Blazers that I want to give away…

1 day ago

101 of the best blogging tools in 2024,

101 of the best blogging tools in 2024. Having the best blogging tools continues to…

2 days ago

Remove the title attribute using jQuery

In WordPress, when you use wp_page_menu your anchor attribute's usually carry a title with the…

2 days ago