How to Create Compact Archives in WordPress (Step by Step)

Displaying archives is an important part of WordPress sites to help visitors discover older content. However, the default WordPress archive block often ends up displaying a cluttered list of hundreds of posts.

This is where compact archives can help. According to WordPress developer Curtis McHale, "Compact archives are the ideal solution to provide site visitors with an easy way to navigate through your content without taking up your entire sidebar."

In this step-by-step guide, I‘ll show you four different methods to create tidy, lightweight compact archives on your WordPress site using plugins, widgets, template tags, and more.

Why Add Compact Archives in WordPress?

Before showing you how to add compact archives in WordPress, let‘s look at some of the key reasons you may want to use them:

1. Prevent Cluttered Sidebars

The standard archive block outputs a long list of archives that quickly eats up sidebar space. Compact archives neatly condense this into a format like Jan | Feb | Mar without taking up much room.

2. Enhance Site Navigation

Compact date or month-based archives allow visitors to easily jump to posts published in a specific timeframe. This improves site navigation and content discoverability.

According to a survey by SeedProd, sites with easy navigation can benefit from 26% higher visitor engagement. Compact archives are an easy way to facilitate this.

3. Match Your Brand Style

Customizing the text formatting or background color of compact archives is a great way to match them visually with your overall site design.

For example, you can capitalize the text or add stylish backgrounds:

Compact archive brand examples

Now that you know the key benefits, let‘s look at a few different methods to add them.

Method 1: Add Compact Archives Block

The easiest approach is to use the Compact Archives plugin which includes a handy Gutenberg block.

To get started:

  1. Install and activate the Compact Archives plugin
  2. Edit a post or page
  3. Click + Add Block
  4. Search for "Compact Archives"
  5. Click the block to add it

You can now customize aspects like the text colors and format:

Customize compact archives block

When done, publish your page and the stylish compact archives will display!

Method 2: Use as a Widget

Alternatively, compact archives can be added as a widget instead of a block:

  1. Go to Appearance → Widgets
  2. Find the Compact Archives widget
  3. Drag it into your preferred sidebar
  4. Customize title, text colors, etc
  5. Save widgets

I like this method because it keeps your sidebar content nice and tidy. Displaying standard archives without this compact formatting tends to create very long, messy widget areas.

Method 3: Add Template Tags

You can programmatically display compact archives using PHP template tags:

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

This will output the default style.

To customize, add parameters:

<?php compact_archive($style=‘style1‘); ?>  

Some common compact archive styles you can specify:

Style ParameterExample Output
style1Jan | Feb | Mar
style201 | 02 | 03
style3January | February | March

For more advanced customization, explore the template tag documentation.

Method 4: Display in HTML Sitemap

To display an HTML sitemap enhanced with compact archive styling, use my favorite SEO plugin, AIOSEO:

  1. Make sure AIOSEO HTML sitemap is enabled
  2. Edit HTML sitemap settings
  3. Switch on Compact Archives

Enable AIOSEO compact archives

The plugin will automatically include neatly formatted compact archives in any HTML sitemap listed on your site.

Wrap Up

I hope this guide has helped explain what compact archives are and the key reasons for using them in WordPress. We‘ve looked at practical step-by-step methods to add compact date or month-based archives using blocks, widgets, template tags, and SEO plugins.

Compact widget formatting is a great solution to prevent messy, bloated sidebars and enhance site navigation for visitors.

Let me know if you have any other questions!

We will be happy to hear your thoughts

      Leave a reply

      TechUseful