Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Create Compact Archives in WordPress

By default, WordPress comes with a widget called Archives, which allows you to display monthly blog post archive links.

Now, if you started a blog few years ago, then this list becomes too long to fit in your WordPress sidebar.

You can choose to show archives as a drop-down menu, but that makes them less noticeable.

In this article, we will show you how to create compact archives that fit in anywhere you want and look much better.

Creating compact archives in WordPress

Why and When You Need Compact Archives in WordPress?

As we mentioned earlier, the default WordPress archives widget is limited in options. You can either display archives as a long list or a dropdown menu.

Due to this issue, many popular blogs don’t display archives on their website at all.

By creating compact archives, you can display them in your WordPress sidebar without taking much space. You can also display them on your about page or a dedicated Archives section.

That being said, let’s take a look at how to easily add compact archives in WordPress.

Adding Compact Archives in WordPress

First thing you need to do is install and activate the Compact Archives plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Compact Archives plugin is developed and maintained by the WPBeginner team. We use it on our own website and recently updated it to add Gutenberg block support.

The plugin offers three styles to display compact archives on your website.

Style 1. Relaxed three-letter month initials

Three letter monthly archives

Style 2. Compact Monthly Initials

Compact archives with initials only

Style 3. Numeric Block

Numeric archives

There are multiple ways to easily display them anywhere on your website.

Let’s start with the easiest one.

Adding Compact Archives in WordPress Posts or Pages

Compact Archives plugin comes with an easy to use Gutenberg block called WPBeginner’s Compact Archives.

If you’re using the new Gutenberg editor in WordPress, then simply edit the post or page where you want to display the archives and add the WPBeginner’s Compact Archives block to your post or page.

Compact Archives block

The block will now appear in the content area of your page. You can click to add a title for your compact archives block and select a style from the block settings on the right.

Compact Archives block settings

Adding Compact Archives to WordPress Sidebar

Another common place to display archive links is your blog’s sidebar. Compact Archives makes it easy to display archive links in your WordPress website without taking too much space in the sidebar.

Simply head over to Appearance » Widgets page and add ‘Compact Archives’ widget to your sidebar.

Contact Archives widget

After that, you can provide a widget title and select a style. Don’t forget to click on the save button to store your settings.

You can now visit your website to see compact archives displayed in your blog’s sidebar.

Display Compact Archives Using a Shortcode

If you are using the older Classic WordPress editor, then you will not be able to use the block to add compact archives in WordPress posts or pages.

Don’t worry, you can still add it by using a handy shortcode.

Simply edit the post or page where you want to display the archives and add the following shortcode.


This shortcode will simply show your compact archives. The shortcode accepts the style, before, and after parameters.

To display your compact archives in the block format, you will use this shortcode:

[compact_archive style="block"]

You can also add your own HTML before or after the archives.

In the following shortcode, we have displayed the compact archive in numeric format and wrapped it around paragraph tags.

[compact_archive style="numeric" before="<p>" after="</p>"]

Displaying Compact Archives in Template Files

If you are making a custom WordPress theme or want to display archives in a theme template file, then Compact Archives comes with handy template tags that you can use.

Simply add the following template tag in your code.

<ul> <?php compact_archive(); ?> </ul>

There are also several parameters that you can adjust:

<?php compact_archive($style='initial', $before='<li>', $after='</li>'); ?> 

These are the same parameters that you can use with the shortcode.

For example, $style == 'initial' will display only month name initials and should fit right inside a sidebar. Using $style == 'block', will fit the main column of a page. Using $style == 'numeric', will display numeric months.

We hope this article helped you easily create compact archives in WordPress. You may also want to see our guide on how to easily create an email newsletter in WordPress to promote your website.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

10 CommentsLeave a Reply

  1. I would like to organize articles written by name categories, not dates. Is there a way to how a page with titles such as Elections or Songs and have a brief commentary of what the post says with a link to the full post?

  2. The “By Date” portion of Compact Archives isn’t working on my blog. I’m wondering if that’s because I had to move my blog to a new web host, or did I mess something up in it? I know enough html/css to be dangerous but usually code via the “trial and error and error and error” method so I probably messed something up…

  3. This one works best for default posts. My blog has custom posts I want to display them as well in compact archives. What should I do now?

  4. Please update this plugin. It seems to cause numerous update issues for other plugins now because it hasn’t been updated in over two years.

  5. This plug-in hasn’t been updated in two+ years, and in particular hasn’t been updated to get rid of the deprecated-as-of-4.3 old constructor calling. Nor have you responded to any of the support requests in the last year.

    Are you still supporting this plugin?

  6. Hi,

    I’d like to know if there is anything special in this plugin? I use SRG Clean Archives. Do you know anything about this plugin? Is it better or I should use the one you suggested?


Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.