How to Limit the Number of Archive Months Displayed in WordPress
If you’re looking for an easy way to limit the number of archived months displayed on your WordPress website we’ll keep watching, because I’ll show you a couple of different ways that you can do that. The first method will be using a plugin called collapsing archive. So let’s head over to our WordPress dashboard. We’ll go over to our Plugins area, click Add New.
And from there you want to search for Collapsing Archives.
This is the one we want. So let’s go ahead and Install it.
And once we’ve Installed it . We’ll need to Activate it as well.
Great now that it’s activated let’s head over to our Appearance area, Widgets.
We need to add the widget to our side bar and customize it.
It’ll collapse all of the years except for as you see down here it’ll Leave the Current one Expanded by Default.
So we’ll click Save.
And now we can visit the site to see what it looks like. So this is what it was before and this is what it looks like now with the Collapsible Widget.
The second method would be to install a different plugin. So let’s head back over to the plugins area and we’re looking for a Compact Archives this time.
This is the one you want. So we’ll Install that.
And we can also Activate it.
Again let’s head over to our widgets area go to Appearance, Widgets.
And we’ll add, add the Compact Archives here.
Once we Save it.
And refresh on the site this is what it will look like and it has the breakdown of each month.
The final method we’ll look at is actually creating a function that you want to add to your Functions.php file. So we’ll copy this.
Head over to our Editor area under Appearance.
Find our Functions.php, head all the way over to the bottom.
As with any changes that you make you want to make sure that you make a backup of your site in case something happens. Find your Functions.php, go to the new line, paste that code in there.
You can Update the file.
And now we can go back to our widgets area. I’ll remove the old one.
Add Custom HTML, put this in here.
You can even give it a Title.
and now when we go to our site now you have a manual archive for your site.