First you really do need to create an archives.php template and here is how it looked:
Please do take note to name the template in the comments above, I haven't had any idea yet if I should but it is a good practice to do so. So above I named it 'Archives' the same as the file name, make sure it is uploaded in the theme's folder. In order for this to show up you need to create a static page. If you are using wordpress 2.7.1 go to Page>Add New, just give it a title of Archives and to the right there is or there should be a dropdown of the template to use, choose the Archives template, don't put anything in the content text area just make sure you have a title, then hit save.<?php
/**
* Theme name here
*/
/*
Template Name: Archives
*/
get_header() ?>
<div id="content"><div class="entry">
<h2>Archives by Month:</h2>
<?php wp_get_archives('type=monthly'); ?><h2>Archives by Subject:</h2>
<?php wp_list_categories(); ?>
</div>
<?php get_sidebar(); get_footer(); ?>
Now that you have this how do you create a link, pretty simple, here is the code:
<a href="<?php echo bloginfo('url').'/'.'?pagename=archives'; ?>">Archives</a>That is it, happy coding. ;)
No comments:
Post a Comment