There has been much debate over the value of displaying your archives on your WordPress blog. Some people are all for it, while others feel that you should move any archives to their own page. No matter which camp you are in, I think both can agree that if you do display your archives, you do not need to display an overabundance of them.
By default, most WordPress themes come with some standard code to display your blog’s archives by month and with no limit to the number of archives to display. Typically the code will look something like this:
<h2>Archives</h2>
<ul>
<?php wp_get_archives('type=monthly'); ?>
</ul>
This will be fine for the first 6 months are so, but once your blog gets a little more established, you’ll probably notice that the number of months displayed are never ending. This can quickly become an eyesore for your blog and people generally won’t want to look at archives more than 6 months old. In order to set a rotating limit of months displayed on your blog, you simply need to make a small change to the above code to add a limit:
<h2>Archives</h2>
<ul>
<?php wp_get_archives('type=monthly&limit=6'); ?>
</ul>
If you want to display more or fewer months, just change the 6 accordingly. Its really that easy!












There Is 1 Response So Far. »
Trackbacks/Pingbacks
Leave A Comment