Code to have Wordpress display a monthly archive?
We are setting up a WP-MU at work and one of my tasks is to make a link in the sidebar that will go to a page displaying a monthly archive.
The sidebar must not contain the archive list just a link to a page (generated on the fly b开发者_StackOverflowy WP) that shows the archive by month.
This is probably simple, but I have spent hours going through Codex and blog posts and not making headway.
Can anyone help me?
Thank you, Frank Luke
WordPress Codex: Creating an Archive should explain how to generate the monthly archive page itself. The template tag to get the monthly archives is:
<?php wp_get_archives('type=monthly'); ?>
If you then have your archives template setup according to Creating an Archive you should only need to add a link as so in the sidebar template (i.e. sidebar.php
):
<a href="/archives.php">Monthly Archives</a>
with the appropriate URI for your setup.
精彩评论