If you have been blogging for a long time on WordPress, your list of archived entries is probably already difficult to fit on the sidebar. The problem is that the standard WordPress widget for displaying Archives displays a list by months. It is not difficult to imagine how this list will look for the last 3 years, for example.

But in this lesson, we show how you can elegantly change the situation and make the archive widget display information in a more convenient way. Let’s get going!

Method 1. Plugin Collapsing Archives

This is the easiest way, we recommend it for all users and newbies in WordPress.

Download and install the free plug-in Collapsing Archives :

After activating the plug-in, go to Appearance → Widgets and add the new “Collapsing Archives” widget to your sidebar:

The widget will open its settings block. The widget works by using JavaScript to open and close the list of records archives by clicking on the arrow. Thus, your visitors will be able to open only the desired year/month and see the records of interest.

As a result, on the site it will look like this:

Following / Before

Method 2. Compact Archives plugin

Unlike the previous plugin, this plugin does not add a new widget for archives, but simply replaces the standard widget with another, more convenient.

Download and install the free plug-in Compact Archives :

After activating the plug-in, go to Appearance → Widgets and add the “Compact Archives” widget to your sidebar:

The Compact Archives widget offers a choice of 3 archive display styles: by blocks, by initials of months and by month numbers.

On your site now the archives will look like this:

Method 3. We add the code manually in functions.php

This method is slightly more complicated than the two previous ones. You need to find the file functions.php in the folder with the active WordPress theme on your site and edit it by adding the following code to the end:

 // Function to get archives list with limited months
function wpb_limit_archives () {
$ my_archives = wp_get_archives (array (
    'type' => 'monthly',
    'limit' => 6,
    'echo' => 0
return $ my_archives;
// Create a shortcode
add_shortcode ('wpb_custom_archives', 'wpb_limit_archives');
// Enable shortcode execution in text widget
add_filter ('widget_text', 'do_shortcode');

This code collects all your archives in a bunch, builds a list from them and selects only the last 6 months. Then he creates a shortcode and activates the support for shortcodes for text widgets on your site.

You still need to go to the Appearance menu → Widgets add a new “Text widget” to the sidebar and enter the following shortcode into it:


Now you can save the widget and go to the main page of the site. You will see in the list of archives only the last 6 months.

The number of months displayed can be changed by editing the number 6 in the code above.

That’s it! We showed you 3 ways how you can change the display of your standard WordPress Archives. Which way did you like the most?

Leave a Reply

Your email address will not be published. Required fields are marked *