window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/12.0.0-1\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/12.0.0-1\/svg\/","svgExt":".svg","source":{"concatemoji":"https:\/\/wpbrilliance.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=5.2.3"}}; !function(a,b,c){function d(a,b){var c=String.fromCharCode;l.clearRect(0,0,k.width,k.height),l.fillText(c.apply(this,a),0,0);var d=k.toDataURL();l.clearRect(0,0,k.width,k.height),l.fillText(c.apply(this,b),0,0);var e=k.toDataURL();return d===e}function e(a){var b;if(!l||!l.fillText)return!1;switch(l.textBaseline="top",l.font="600 32px Arial",a){case"flag":return!(b=d([55356,56826,55356,56819],[55356,56826,8203,55356,56819]))&&(b=d([55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447],[55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447]),!b);case"emoji":return b=d([55357,56424,55356,57342,8205,55358,56605,8205,55357,56424,55356,57340],[55357,56424,55356,57342,8203,55358,56605,8203,55357,56424,55356,57340]),!b}return!1}function f(a){var c=b.createElement("script");c.src=a,c.defer=c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var g,h,i,j,k=b.createElement("canvas"),l=k.getContext&&k.getContext("2d");for(j=Array("flag","emoji"),c.supports={everything:!0,everythingExceptFlag:!0},i=0;i
Aug 7, 2019
7 Views
0

How to Create Compact Archives in WordPress

Written by

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. 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…

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.

[compact_archive]

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=”

” after=”

“]

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.

There are also several parameters that you can adjust:

    ', $after=''); ?>

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.

The post How to Create Compact Archives in WordPress appeared first on WPBeginner.

Article Categories:
wordpress · WordPress Plugins

Leave a Reply

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

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc a odio nec justo rutrum faucibus.
$20
Buy Now