How to Create a Simple WordPress Tag Cloud using wp_tag_cloud

5 Sep 2010

Displaying your post tags anywhere in your WordPress blog is simple. Usually it is displayed in the sidebar area of a WordPress site like the one you see on the right sidebar of

Folks usually place this code in their sidebar.php file but you can place them anywhere you like.

For this post, I will walk through the steps on how to create a simple WordPress tag cloud similar to that you see on the right sidebar of this page. We will be utilizing the wp_tag_cloud function as it is the simplest and easiest to customize.

Read on to find out more.

Simple WordPress Tag Cloud using wp_tag_cloud

Here’s the exact HTML and PHP code I use to display tags for this website:

<div class="stagswrap">
<h3>Popular Tags</h3>
<?php wp_tag_cloud('smallest=15&largest=15&number=20&orderby=count&
order=DESC&exclude=312&unit=px'); ?>

This code produces this (as seen on my right sidebar):

CSS Codes

Here are the CSS codes I used:

.stagswrap a {
background: #FFC414;
color: #FFF;
display: inline-block;
margin: 0 4px 8px 0;
padding: 2px 10px;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
font-size: 15px;

Author - Azhar Kamar

Write a Comment! NOW! :)

Current ye@r *