Posted by KaiseRCrazY on 2nd October 2009
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…
This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.
Post your comments
-
Categories
Colored Tags
sidebar css RSS hide comment plugin functions.php if template article index.php Yahoo comments.php no-index single.php time author feed site else post javascript Google theme category Loop style.css content funcitons categories header.php Functions robots spiders title Facebook code blog Widget posts function comments image Wordpress mysqlRecent Comments
Archives
Blogroll
Google Ads















Made by Symmetric Web
Distributed by Smashing Magazine
No Responses
[...] And add these lines for category and the others… Categories Monthly ArchivesContinued here:Make an Archives Page TemplateRelated Posts:Find Out How To Acquire The Best Landing Page Template For Your CompanyDo You Have A [...]