Make an Archives Page Template
As default themes have an archives.php. But if you want to make changes on your arcihves.php or if you’re an theme developer you can use this template quickly. You can get more information on Codex Page. Lets Begin…
Here is the code;
First Create an information and name area;
<?php /* Template Name: Archive page */ ?>
After that add these lines for page template; with this code you list all your articles.
<?php
$posts_to_show = 100; //Max number of articles to display
$debut = 0; //The first article to be displayed
?>
<?php while(have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<ul>
<?php
$myposts = get_posts('numberposts=$posts_to_show&offset=$debut');
foreach($myposts as $post) :
?>
<li><?php the_time('d/m/y') ?>: <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
<?php endwhile; ?>
And add these lines for category and the others…
<?php while(have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<h2>Categories</h2>
<ul><?php wp_list_cats('sort_column=name&optioncount=1') ?></ul>
<h2>Monthly Archives</h2>
<ul><?php wp_get_archives('type=monthly&show_post_count=1') ?></ul>
<?php endwhile; ?>
Now, save the articles.php and upload to your template’s area. Go to Pages > New Page and select the Page Template with Archives.php.
That’s All…
